0
0
Rest APIprogramming~10 mins

Postman collection organization in Rest API - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a new Postman collection named "My API".

Rest API
pm.collection.create({ name: "[1]" });
Drag options to blanks, or click blank then click option'
ASample Collection
BAPI Test
CMy API
DTest Suite
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different collection name than specified.
Forgetting to put the name in quotes.
2fill in blank
medium

Complete the code to add a request named "Get Users" to the collection.

Rest API
pm.collection.items.add({ name: "[1]", request: { url: "https://api.example.com/users", method: "GET" } });
Drag options to blanks, or click blank then click option'
AGet Users
BUsers List
CFetch Users
DRetrieve Users
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different request name.
Not matching the case exactly.
3fill in blank
hard

Fix the error in the code to set the request method to POST.

Rest API
pm.collection.items.add({ name: "Create User", request: { url: "https://api.example.com/users", method: "[1]" } });
Drag options to blanks, or click blank then click option'
APOST
BPUT
CDELETE
DGET
Attempts:
3 left
💡 Hint
Common Mistakes
Using GET or PUT instead of POST.
Using lowercase method names.
4fill in blank
hard

Fill both blanks to add a folder named "User Operations" and add a request named "Delete User" inside it.

Rest API
const folder = pm.collection.items.add({ name: "[1]", item: [] });
folder.items.add({ name: "[2]", request: { url: "https://api.example.com/users/123", method: "DELETE" } });
Drag options to blanks, or click blank then click option'
AUser Operations
BUser Actions
CDelete User
DRemove User
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping folder and request names.
Using incorrect names.
5fill in blank
hard

Fill the blanks to create a request with a JSON body and add it to the collection.

Rest API
pm.collection.items.add({ name: "[1]", request: { url: "https://api.example.com/users", method: "POST", header: [{ key: "Content-Type", value: "[2]" }], body: { mode: "raw", raw: JSON.stringify({ name: "John" }) } } });
Drag options to blanks, or click blank then click option'
ACreate User
Bapplication/json
Capplication/xml
DAdd User
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong Content-Type header.
Not stringifying the JSON body.