Day 12 - AssertionError when submitting collection

My question:
I’m trying to submit for day 12, but I keep getting errors on the “get single collection” and “get single environment” endpoints.

Here’s a screenshot:

I don’t understand why it’s giving a 404 error when the endpoints are running fine individually.

The 404 errors come from the code in the submit request not the requests in the collection.

There are a couple of sendRequests and its these that are failing. With 404 page not found.

Lets look at the first one as an example.

const collRequest = {
  url: `${res.form.collectionId}`,
  method: 'GET',
  header: {
    'x-api-key': `${res.headers["x-api-key"]}`

pm.sendRequest(collRequest, (error, response) => {
  if (error) {

  pm.test('get single collection', () => {
    pm.expect(response)'code', 200);
    pm.expect(response)'status', 'OK');
    pm.expect(response.json().collection.auth.type, 'check collection authorization').to.equal("apikey")

    pass += 1

I suspect its because the URL is incorrect. The following is the relevant info from the instructions where you set the collectionId as an environment variable.

  • Create an environment : Create a new environment called Postman API env . Add the following environment variables:
  • collectionId with the collection id for Day 12: Postman API
  • environmentId with the environment id for Postman API env
  • workspaceId with the workspace id for your current workspace; you may need to do some research on this one
  • :warning: Remember to only use CURRENT VALUE for sensitive tokens like your API key
    Send the requests to ensure you get successful responses, and save your changes.

The submit request also needs to be configured.

  • Get the environment ID: Get the environment ID , and enter it under the Body tab as form-data for environmentUid .
1 Like

I had the same issue and after reading @michaelderekjones response below I realized what was wrong. If you print out to the console the value of the res variable in the test file you’re going to see why 2 of the requests fails while the “get single workspace” request succeeds. The request to get the collection make a reference to a property named collectionId while in the form object, the property is named collectionUid, for example.

So, what I think is going on is that the submit instructions for this challenge are incorrect. They ask you to submit under the form-data tab three k-v pairs: workspaceId (the only one that passes the test because it has the correct name in the request url), environmentUid (should be just environmentId because that’s how it’s being referenced in the Tests tab of the Submit file), and collectionUid ( which should be collectionId)

Hola agregue el header x-api-key en el submit y se soluciono!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.