Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a new Postman collection with a name.
Postman
const collection = new Collection({ name: [1] }); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put quotes around the collection name.
Using a variable name without defining it.
✗ Incorrect
The collection name must be a string, so it needs to be in quotes.
2fill in blank
mediumComplete the code to add a request to the Postman collection.
Postman
collection.items.add(new Request({ url: [1], method: 'GET' })); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around the URL string.
Using the HTTP method as the URL.
✗ Incorrect
The url must be a string, so it needs to be in quotes.
3fill in blank
hardFix the error in the code to correctly create a collection with an empty array of items.
Postman
const collection = new Collection({ name: "Test", items: [1] }); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using an object {} instead of an array.
Using null or zero which are invalid for items.
✗ Incorrect
The items property expects an array, so an empty array [] is correct.
4fill in blank
hardFill both blanks to create a collection and add a request with a POST method.
Postman
const collection = new Collection({ name: [1], items: [] });
collection.items.add(new Request({ url: "https://api.test.com", method: [2] })); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using GET instead of POST for the method.
Not using quotes around strings.
✗ Incorrect
The collection name must be a string, and the method must be 'POST' as a string.
5fill in blank
hardFill all three blanks to create a collection with a request that has a URL, method, and description.
Postman
const collection = new Collection({ name: [1], items: [] });
const request = new Request({ url: [2], method: [3] });
request.description = "Sample request";
collection.items.add(request); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using POST instead of GET for the method.
Forgetting quotes around strings.
✗ Incorrect
The collection name and URL must be strings, and the method is 'GET' as a string.