Updating with CSV

I’m a novice here when it comes to Postman and most things development but have a hopefully quick question pertaining to using Postman to update a series of records with a csv file. All I am wanting to do is mass update a series of account records that are defined in a csv file.

I’ve read through the blog posting on this topic:

My collection:
https://www.getpostman.com/collections/53dc7bec3a3e5b6b47cf

And still encounter the error:
Could not read JSON: Unexpected character (’{’ (code 123)): was expecting double-quote to start field name\n at [Source: org.apache.catalina.connector.CoyoteInputStream@256f884d; line: 2, column: 11]; nested exception is org.codehaus.jackson.JsonParseException: Unexpected character (’{’ (code 123)): was expecting double-quote to start field name\n at [Source: org.apache.catalina.connector.CoyoteInputStream@256f884d; line: 2, column: 11]

I assume this has to do with the body where I am referencing parameters {{Id}} and {{PaymentTerm}}.

{
“Id”: {{Id}},
“PaymentTerm”: {{PaymentTerm}}
}

The Zuora REST API is specific in that I have to insert the key in the url such as:

https://rest.apisandbox.zuora.com/v1/accounts/{{Id}}

Thoughts on how to get this to work?

Thank you in advance!

When you preview the CSV file, does it show you the data properly. I’d also suggest double checking the CSV headers for the correct variable names.

Thanks for the reply and suggestions. The preview does show the data properly. I kept it simple with two columns and two rows. Even in the console, it shows it correctly:

Request Body:"{ “Id”: 2c92c0f94d94d061014d96336fb44a2b, “PaymentTerm”: Net 30 }"

Puzzling.

You should enclose the “Id” field in your request body with quotes. Postman does not automatically add quotes for string types.

We are closer, thank you.

I am now getting the error:

code:51500021

message:“Invalid parameter(s): ‘Id,PaymentTerm’.”

I got it to work, I needed to remove Id from the Request Body. Thanks again for the help.

Here is the blog post I created to help if any others have this issue:

1 Like

One info here I thought would be of help - you can use another library for parsing CSV inside script. The module “csv-parse” is available for use inside the scripts.

https://www.npmjs.com/package/csv-parse