API Test Automation - Assignment #2

I am running into an issue with Assignment #2, I have change the Current Value to my generated API key for the collection, but when I try to run Create an Order, itā€™s saying invalid API and giving a 403 not authorized response.

I have tried creating a new API key, and I have tried using the same API key I used on Assignment #1, I donā€™t know what else to try at this point or what oversight I am making.

When I run the test individually it fails, and when I run verify your work, everything passes except Create a new order. Any thoughts as to where I am getting hung up? Thanks!

Hey @keiralew :wave:

Welcome to the Postman Community! :postman:

By API Key do you mean the value created using the register a new client request or the Postman API Key?

I am using the Postman API key via the directions in the assignment. Did I read those incorrectly?

The API for the assignment is different to the Postman API Key that you may have previously used.

If youā€™re following along with the video, it explains that in there.

At the 20:30 point in the video is where @vdespa explains about using the request I mentioned.

I did try the token that is generated when you register a new client, but I thought that for verification of the assignment it needed the Postman API specifically?

Either way, I tried that again and I got the following response body:

{
ā€œerrorā€: {
ā€œnameā€: ā€œAuthenticationErrorā€,
ā€œmessageā€: ā€œInvalid API Key. Every request requires a valid API Key to be sent.ā€

Also, none of the tests ran and I got this error:

There was an error in evaluating the test script: TypeError: Cannot read properties of undefined (reading ā€˜itemā€™)

If I use the Postman API the tests will run and 10/11 pass, just the create new order fails. I am trying to apply both the Postman API and the Register New Client token in the Collection Variables of Assignment 2.

This is the link to my workspace if that helps.

https://www.postman.com/keiralew/api-test-automation

I know itā€™s something dead simple that I am overlooking! Thanks so much for the help!

Hmm, I played around with it and now all 11 tests are passing, although I have no idea why. LOL Oh well, I will take it. Thanks!