Using Postman and CSV data files to mass update Zuora
Mass updating Zuora records can be a challenge. Postman offers an easy method of doing so with a few simple steps.
Mass updating Zuora records can be a challenge. Postman offers an easy method of doing so with a few simple steps.
Postman is the complete toolchain for API developers, used by more than 3 million developers and 30,000 companies worldwide. Postman makes working with APIs faster and easier by supporting developers at every stage of their workflow, and is available for Mac OS X, Windows, Linux and Chrome users. Best of all, it is free to use.
Postman’s Collection Runner is a powerful tool. As its name implies, the Collection Runner (CR) lets you run all requests inside a Postman collection or folder one or more times. It also executes tests and generates reports so you can see how your API tests compare to previous runs.
There is a comprehensive blog post on how to create and use Postman and csv files here:
http://blog.getpostman.com/2014/10/28/using-csv-and-json-files-in-the-postman-collection-runner/
We'll bridge the gap between that blog post and how it applies to Zuora in the remainder of this blog post.
If you can use Zuora Developer Tools, you can use Postman to do many of the same functions. Here are the high level steps that need to be completed:
Please view the following Postman Article: https://www.getpostman.com/docs/postman/collections/creating_collections
To create the request, here is the Postman Article: https://www.getpostman.com/docs/postman/sending_api_requests/requests
1. Choose the Request Type
In this case PUT as we are updating the Invoice Status from Posted to Canceled.
Here is a link to the Zuora API Reference: https://www.zuora.com/developer/api-reference/#operation/Object_PUTInvoice
2. Enter your Endpoint URL
In this example, we will mass update the Invoice status from Posted to Canceled
Our Endpoint URL is: https://{{zuora_host}}/v1/object/invoice/{{Id}}
3. Setup your Postman Environment.
You can either use OAuth or Basic Auth. Using environments provides an easy way to use variables. For example, adding the {{zuora_host}} in the endpoint above. You can create two different environments, one for production and one for sandbox where each environment has their own set of values.
4. Create the JSON Request Body
Zuora requires a two step process for moving a posted invoice to a canceled status.
For the first request, we are updating the Zuora invoice status from Posted to Draft
For the second request, we are updating the Zuora invoice status from Draft to Canceled.
At this stage you should have two files in your collection or folder.
5. Create your Tests
You can create tests to see if there is a valid response. Below is a simple example:
From the main menu, go to File > New Runner Tab
A new tab will launch in your main window with the Run Settings.
1. Upload your CSV file before clicking the Run button. Here is an article that explains all of the fields and variables:
https://www.getpostman.com/docs/postman/collection_runs/starting_a_collection_run
Note: The iterations field will update automatically to the number of rows in your CSV file.
2. Drag your collection or folder with the two requests into the main window. In this example, there were three requests in the Mass Update Invoices folder and we unchecked the one that wasn't applicable for this run.
Once you click the orange run button, you should see the request results complete succeessfully.
1. We were unable to get this to successfully complete with the web UI. We had to download the desktop app.
2. If you are having debugging issue, try viewing the console. It has helpful debugging details. You can access the console from the menu: view > Show Postman Console