Use Postman by organising one collection per Java API, with folders per resource, two or three environments for base URLs and tokens, and a saved example response plus a few test scripts on every request. Written carefully, that collection works as lightweight documentation: a mentor can open it, read the descriptions, run the folder and see what your API does without touching your code.
This guide gives a complete collection template for a Spring Boot style REST service, a worked illustrative example, a scorecard for self-review, and notes for Karnatak University students planning an internship. Everything is written for a 14-day internship schedule, where there is no time to waste on untidy tooling.
Why a Postman Collection Suits a Short Java Internship
In a two-week project you will probably write a handful of controllers, a service layer and a database mapping. A mentor reviewing remotely cannot read every class. A collection gives them three things quickly:
- Proof that endpoints work: requests with passing tests are easier to trust than a screenshot.
- A contract: methods, paths, headers, request bodies and expected status codes in one place.
- A repeatable demo: the mentor can run the collection against your local server or a deployed one by switching environments.
It does not replace unit tests (JUnit, Mockito) or OpenAPI/Swagger documentation. Treat it as the layer that shows the running API from a client’s point of view.
Collection Structure Template for a Java REST API
Name the collection after the project, for example Student-Library-API. Use folders that mirror your resources, with a numbered prefix so the order is obvious.
Student-Library-API
00 Read Me (collection description)
01 Auth
POST Register
POST Login (saves token)
02 Books
POST Create book
GET List books (pagination)
GET Get book by id
PUT Update book
DELETE Delete book
03 Members
... same pattern
04 Negative cases
POST Create book - missing title (400)
GET Get book - unknown id (404)
GET List books - no token (401)
05 Smoke run (order for a full demo)
What goes in the collection description
The description of the collection is the first thing a mentor sees. Keep it to this skeleton:
- One sentence on what the API does.
- Java version, framework and how to start the server (for example
mvn spring-boot:run), plus the default port. - Which environment to select and which variables to fill in.
- The order to run the requests for a full demo.
- Known limitations, such as “no refresh tokens yet”.
Free 2-Week CareerSwami Internship
Online, 14 days, with a free offer letter and a free completion certificate once you finish the work. Check with your college that it fits your requirement before you enrol.
Environment Setup: Local, Test and Deployed
Environments keep URLs and secrets out of individual requests. Create one per place the API runs, and use the same variable names in each.
| Variable | Local value | Deployed value | Notes |
|---|---|---|---|
baseUrl |
http://localhost:8080 | Your hosted URL, if any | Never hard-code in requests |
username |
demo_user | demo_user | Use a throwaway account |
password |
(set locally) | (set locally) | Use the “secret” variable type; do not export real passwords |
token |
empty | empty | Filled automatically by the Login test script |
bookId |
empty | empty | Filled by Create book so later requests chain |
Before sharing, export the collection and environments and check that no real credentials, API keys or personal data are present. Share the environment file with blank secret values.
Example Requests with Expected Responses
The examples below are illustrative. They describe a hypothetical library API and have not been run against any real server. Adjust paths and fields to your own project.
| Request | Body / headers | Expected status | Expected response highlights |
|---|---|---|---|
| POST {{baseUrl}}/api/auth/login | JSON with username, password | 200 | Contains a token field |
| POST {{baseUrl}}/api/books | Authorization: Bearer {{token}}; JSON with title, author, isbn | 201 | Returns id; Location header if you set it |
| GET {{baseUrl}}/api/books/{{bookId}} | Bearer token | 200 | Same title and author as created |
| GET {{baseUrl}}/api/books?page=0&size=5 | Bearer token | 200 | Array or page object, at most 5 items |
| POST {{baseUrl}}/api/books (no title) | Bearer token; JSON missing title | 400 | Error message naming the invalid field |
| GET {{baseUrl}}/api/books/999999 | Bearer token | 404 | Consistent error body |
| GET {{baseUrl}}/api/books (no token) | None | 401 | No book data leaked |
Saved examples as documentation
For each request, use “Save as example” on a real response from your running service. Postman shows these under the request, so a mentor sees a sample success and a sample error without running anything. Name them clearly: 201 Created, 400 Missing title.
Test Scripts That Check Status, Shape and Chained Values
Postman test scripts are written in JavaScript in the Tests tab. These are illustrative snippets for the login and create requests.
// Login request - Tests tab
pm.test("Status is 200", () => pm.response.to.have.status(200));
const body = pm.response.json();
pm.test("Token present", () => pm.expect(body.token).to.be.a("string"));
pm.environment.set("token", body.token);
// Create book - Tests tab
pm.test("Status is 201", () => pm.response.to.have.status(201));
const book = pm.response.json();
pm.test("Has id and title", () => {
pm.expect(book.id).to.exist;
pm.expect(book.title).to.eql("Effective Java");
});
pm.environment.set("bookId", book.id);
Keep tests small. Check the status code, one or two key fields and response time only if you have a reason. Over-specified tests break whenever you rename a field.
Worked Example: Day-by-Day Use of the Collection in a 14-Day Plan
This is an illustrative plan for a student building a small book-lending API. Adapt the scope to your track and your mentor’s guidance.
| Days | Build work | Postman work |
|---|---|---|
| 1-2 | Project setup, entity design, database config | Create collection, README folder, local environment |
| 3-5 | Books CRUD endpoints | Add one request per endpoint, save first examples |
| 6-7 | Validation and error handling | Add the Negative cases folder with 400 and 404 tests |
| 8-10 | Authentication (JWT or basic) | Login request that stores the token; add 401 test |
| 11-12 | Pagination, a second resource | Chain variables; build the Smoke run order |
| 13 | Cleanup, JUnit tests, deploy if possible | Run the collection with the Collection Runner; fix failures |
| 14 | Final report and demo | Export collection and environment; write the description |
On day 13, the Collection Runner executes every request in order. Suppose the 404 test fails because your controller returns 500 for a missing id. That is exactly the bug the collection is meant to catch: you fix the exception handler, rerun and the folder turns green. In your report you can state this honestly as a defect found and fixed through the collection.
Turning the Collection into Documentation for a Mentor
- Describe every request in two lines: purpose, and any rule (for example “isbn must be unique”).
- Document parameters in the Params and Body tabs using the description column.
- Use the Smoke run folder so there is one obvious way to see the whole API work.
- Publish or export: Postman can generate documentation from a collection, or you can export JSON and include it in your repository under
/docs/postman. - Link from your README with the steps to import the collection and select the environment.
If you are doing the free two-week CareerSwami online internship in a Java track, a clean collection is a compact deliverable to show alongside your code. The programme offers a free offer letter and a free completion certificate after successful completion; the collection is simply your evidence of what you built.
Self-Review Scorecard for Your Postman Collection
Score each row 0 (absent), 1 (partial) or 2 (complete) before you share the collection. Out of 20, aim for 16 or more.
| Criterion | What a 2 looks like |
|---|---|
| Structure | Folders per resource, numbered, with a Read Me |
| Environments | No hard-coded URLs; secrets blank in exports |
| Coverage | All CRUD endpoints present |
| Negative cases | At least 400, 401 and 404 tested |
| Tests | Status plus key fields checked on every request |
| Chaining | Token and ids set by scripts, not pasted |
| Saved examples | Success and error examples on main requests |
| Descriptions | Every request explained in plain English |
| Runner result | Whole collection passes in order on a fresh database |
| Hygiene | No real passwords, tokens or personal data in the export |
Karnatak University Students: Fitting a Postman-Documented Java Project into Internship Rules
Karnatak University, Dharwad publishes a document titled Draft Regulations Governing Apprenticeship/Internship Embedded Four-Year Undergraduate Programmes as per NEP-2020, marked effective from 2022-23. It is a draft from 2022, so treat the details as indicative and check the current version before relying on them.
Several points in it matter for a Java student. The draft says the programmes include at least one semester of compulsory apprenticeship or internship, and that the internship is undertaken at the workplace rather than on campus. It also says departments, constituent colleges and affiliated institutes must first sign MoUs with host organisations. In practice, a self-chosen online internship may not automatically count toward university credit; whether it does is a decision for your department. The draft also mentions a minimum of 3 weeks of job-specific training worth 6 credits for certificate or diploma exits, which is longer than a 14-day internship. CareerSwami does not offer academic credit, so treat this internship as skill-building and portfolio evidence unless your department says otherwise in writing.
On assessment, the draft says the mechanism may be chosen by the institution in consultation with the host organisation, and that the university will issue guidelines separately. That means the format of your report is not fixed in the document. A Postman collection, exported and described well, is a sensible attachment, but ask whether your department wants it.
The draft also allows credits from SWAYAM and other platforms the university recognises, but does not mention online internships specifically.
Verification steps for Karnatak University students
- Ask your department office or internship coordinator whether a final version of the NEP apprenticeship/internship regulations has replaced the 2022 draft, and request the current PDF.
- Email your coordinator asking, in writing, whether a free online internship counts toward the apprenticeship/internship requirement, and keep the reply.
- Ask which assessment guidelines and report format apply to your programme and semester.
- Ask whether the host must have an MoU with your college, and whether an offer letter and completion certificate from an online programme are acceptable evidence.
- Confirm with your mentor or guide whether exported Postman files and a README may be submitted as project documentation.
Common Postman Problems in Java API Testing and How to Fix Them
- Connection refused: the Spring Boot app is not running, or the port differs from
baseUrl. Check the console for the port. - 401 on every request: the token variable is empty. Run Login first, and confirm the environment is selected in the top-right dropdown.
- 415 Unsupported Media Type: set the body type to raw JSON so the Content-Type header is
application/json. - CORS errors: these appear in browsers, not in Postman. If Postman works but your front end fails, configure CORS in Spring.
- Tests pass once, fail on rerun: unique constraints such as isbn. Generate values with
{{$randomInt}}or clean the database between runs. - Variables not resolving: check scope. Environment variables set in scripts need
pm.environment.set, not collection variables.
Frequently Asked Questions
Is Postman enough to test a Java API for an internship?
It is enough to show the API behaves correctly from a client’s view. Pair it with JUnit tests for service logic if your mentor expects them.
Should I use one collection or one per module?
Use one collection per API project, with folders per resource. Split only if you have separate services that deploy independently.
Can I share my collection without leaking passwords?
Yes. Mark secrets as secret-type variables, leave their values blank before exporting, and review the exported JSON in a text editor before sending it.
Do I need a Postman account?
Not necessarily. You can work locally and export JSON. An account helps with cloud sync and generating shareable documentation; follow Postman’s current plan limits.
How is a collection different from Swagger/OpenAPI?
OpenAPI describes the API contract, often generated from code. A collection shows real requests, test results and sample responses. Many projects use both.
Will my Karnatak University department accept a Postman collection as a report?
That is not stated in the draft regulations. Ask your internship coordinator what format is required, and offer the collection as a supporting appendix.
How many requests should the collection have for a 14-day project?
Usually 15 to 30: CRUD for two resources, login, and a handful of negative cases. Quality of tests and descriptions matters more than count.
Can I run the collection automatically?
Yes. Use the Collection Runner in Postman, or the Postman CLI/Newman if your mentor wants a command-line run in a build pipeline.
Related Java & Enterprise Software guides
- The NorthCap University: Presenting Your Java Internship Work in a Ten-Minute Demo
- Institute of Advanced Research Students: Ethical Habits for Java Interns Handling Company Data
- XIM University Students: Java Internship Opportunities for Business and Management Majors
- All Java & Enterprise Software internship guides
Ready to put this into practice?
Join the free two-week CareerSwami online internship in Java & Enterprise Software. The internship, the offer letter and the completion certificate are free.




