HTTP Request parameters giving errors

Hi,
I am trying to use the CDC api in my automation project. I keep getting this error which I have printed in a message box to find my problem. I am attaching my endpoint, parameters, the message box with the error when outputting the resulting JSON string, and what the same endpoint shows when I run it in postman.

I have already tried to put my parameters in the URL segment instead of in the parameters which then gives me a different error due to the same variable being defined elsewhere. I tried changing those and inputting them which ended up giving me the same exact error message.

I do not know what else to try so thanks for any help figuring this out.
Nicole

error postman

Can u put the endpoint in string format

Like create the variable for State, Beginning, Ending and then concatenate the endpoint with the varaible like.manual string manipulation

for eg

"https://data.cdc.gov/resource/9mfq-cb36.json?state="+State+"&$where=submission_date between “+Beginning+” and "+Ending

Where State, Beginning, Ending are varaible created for string respective values

Try this way

Hope it helps :blush:

Mark it as solution if it helps you

Regards

Nived N :robot:

Happy Automation :slight_smile::slight_smile::slight_smile::slight_smile:

Hi,
Thanks for the response. I tried changing it like you suggested and I am now getting a different error showing up which I have attached here.
Thanks again,
Nicole

Screenshot 2020-11-26 213716

Hi @Nicole_Holden can i try that url?

Go for it I got it from the CDC website for a group project.

Like can u tell the parameter values?

My variables are State=“TX”, Beginning=“2020-11-19”, Ending=“2020-11-26”. Sorry I didn’t think to include them.

image

I am too also getting same error
I think it is an sql query right ?

Because for SQL query we mostly write like this

Select * from table where …

I think here u haven’t mention the name of table

I believe this is a filter but I am not sure as I am using an online api. But I do know that this endpoint works with these parameters as I tested it using postman. From the api docs one of the suggested filters is: json?submission_date=2020-01-22T00:00:00.000.

I looked at it again and it is a SoQL query and found that the way to connect 2 conditions in the query is connecting it with “AND” instead of “&”. Making this change gets rid of the error but only gives an empty array.

@Nicole_Holden Can you make sure the parameter that you are providing is same as the key present. Such as “State” should actually be “state”

It seems to work if you surround the date values with apostrophes (ex: ‘2020-11-19’).
The ampersand (&) is used for defining the URL, not for the SOQL query.

1 Like

Thanks for the help I have never encounter SOQL queries before. I did not know anything with computers or coding before this summer so I’m still learning a lot every day.

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