Add body data ( add data in body step)

In student expert training while doing added body data step.
Getting response as this seems to be HTML and not JSON.
PLEASE HELP

Hi @raghavkhanna can you post screengrabs of your request setup so that people will be able to help?

here it is

So all of the steps in the skill check request cover the same skills you covered in the first two folders in the collection. If you check back in a previous request that you sent body data (in the first folder) you should be able to figure out the syntax error you have in your body data here. I don’t want to tell you what it is because the purpose of this request is to check you’re able to carry out the same steps independently… :slightly_smiling_face:

If you get stuck at any other parts of the skill check request please try looking back at the previous requests!

Thanks! i got the error and resolved it.

1 Like

Add Test script code to set a variable (collection or environment) named ‘responseData’, with the value from the response JSON rand property. Hint: You’ll need to Send the request twice after adding your code because it won’t save the value until after the response is received the first time.

What exactly i need to do here?? i’m stuck here from a long time, any help will be appreciated .

@raghavkhanna Hey, did you find the solution?

Hi @diksha! Replying here rather than in your DM so that other people can see if they get stuck too. If you look back at the requests in the second folder you should see examples similar to what you need for the test script. You’re trying to set a var named responseData and give it a value your script gets from a property named rand in the response JSON (so your script needs to do two things: get the property from the response JSON, and set it as the value of a var).

The purpose of this part of the course is to check you can reapply what you covered in the earlier stages so I can’t give you the full answer…! :wink:

So I going correct, right?

@suesmith actually the variable value is changing but i could not pass the task.

@diksha that may mean it doesn’t have the correct value - it needs to be the value of the rand variable in the response.

@suesmith yes it is. Every time i am hitting send the value in the variable changes and it is same as the value received from the body.

@diksha Have you changed the code from the version in the message you sent me? In that your code isn’t referencing the rand var so I would double-check that!

Done with the skill test.
Thanks!

FAIL
Set env variable from script and set next request | AssertionError: expected to have a length above 0 but got 0
Got this error will tesing colletions through public link.
Could you help?
@suesmith

1 Like

I have completed that all the things but still I’m not able to submit. Because there is no proper explanation of things. I hope in future this training will be displayed as students and not as advance persons. @diksha if you able to submit please let me know. I’m still looking for the solution. Cheers!

Hi, so the course is for Postman Student Expert certification and we therefore look for a relatively advanced skill level in using Postman - to get yourself up to speed on Postman basics we have a ton of learning resources you can try out :slightly_smiling_face: https://learning.postman.com/

@suesmith Done!
Thanks!

1 Like

I am getting the same error. How did you resolve it?
Could you help?