Day 9: Failures when submitting Solution

Hi everybody! Hope you are ok all.

I’m stuck with SUBMIT request (the 9th day).

TypeError: undefined is not an object (evaluating ‘collection.item’).

What is the error? I revised all the names of the folders/requests etc.

Thank you very much for your help and suggestions.


Or the problem with authentication?
(see console.log(pm.response.json()))

Gracias!!

It’s not returning the collection information, as you have a 401 unauthorised.

I suspect the body will show an error regarding the API key.

You need to add the API key, as you’ve done for all of the previous challenges.

Quick tip. I used an environment variable for my API key.

Each of the challenges (after the first one) already has the x-api-key in the headers.

You need need to ensure the {{postman_api_key}} variable is set correctly. (I lost count of the number of times I forgot to select the environment when submitting the final request).

1 Like

Many thanks, Mike! I’ll try.

Yes. It is so.

So we know why you are getting your initial error.

Where are you storing the postman_api_key value?

It should be the same process you’ve used for the previous challenges.

My recommendation is to use an environment variable and just ensure you have the environment set when you send the request.

Auth of the collection

Auth of request GET - 200 OK

Auth of request POST - 200 OK

Auth of SUBMIT - Inherit auth - ERROR

Auth of SUBMIT with API key - ERROR

What is wrong? :grimacing:

You can ignore the GET and POST requests in the other folder, as they are not related to the authorization of the submit request.

You do not need to change the authorization settings at the collection or request level.

That should just be set to inherit from parent. So please set it back to that.

Please look at the screenshot I included previously. This is a screenshot of the submit collection request that is unaltered. It shows you that by default the x-api-key is already included, and is looking for a variable called postman_api_key.

When you highlight the variable in the headers tab of the submit request, it should show the current value (similar to what its doing in the authorization screen shot you’ve included).

It looks like in the initial value you have the variable name posted instead of an actual value which wouldn’t have worked. Basically, the variable calling itself. Instead of the value.

You don’t really need to worry about the initial value. It’s the current value that is important. It should a valid API key and should be in the format PMAK-xxxxxxxxxxxxx.

You haven’t included enough of the screenshot for me to tell if you’ve selected the environment from the drop down which is where I suspect the problem lies.

TLDR: You need to check your environment for a variable called postman_api_key and then ensure that the environment is selected before submitting the request. The current value needs to have your API key which should be in the format PMAK-xxxx. That’s all you should really need to do.

What I don’t quite understand is that you’ve had to do this when submitting the previous requests. So the process should be familiar by challenge # 9.

Mike, thank you for your patience and help. :pizza: I’ll be back when I get the day 9th submitted.

Mike, it has helped me. When I turned off authorization in the collection (“Day 9: …”).
I really appreciate your help.
Thank you very much.

1 Like

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