Zuora Billing REST API | Extracting Custom Objects

Thauren Heavyside
2 min readApr 7, 2022

--

This article outlines the process I took to extract custom Zuora objects for campaign analysis using the Zuora Billing REST API.

Before you can start extracting the objects you would first need to authenticate to the Zuora REST API using a Client ID and Client Secret to generate a bearer token. In my case, the ID and Secret was provided by the team exposing these objects. However, the above link describes that one would need to create an OAuth client using the Zuora UI to generate a Client ID and a Client Secret.

Once you have the Client ID and Client Secret you will need the “Base URL for REST Endpoint” (see above link) depending on your region you will send a POST request using a grant_type set to “client_credientials”.

Once you receive the result from the POST request you can extract the access token by converting the json string to a python dictionary and then accessing the bearer token at the key “access_token”. See python example below using the json and requests libraries,

Then to make an authenticated GET request using the bearer token you would set it up as such:

Authorization: Bearer {bearer_token}

This would then be passed in the GET request.

These are the endpoint URLs for the GET request I found useful:

  • To retrieve object definitions: GET <BaseURL>/objects/definitions/default/<NameOfObject>
  • To retrieve all records for that Object: GET <BaseURL>/objects/records/default/<NameOfObject>
  • To retrieve a specific record: GET <BaseURL>/objects/records/default/<NameOfObject>/<record_id>

Now, to make the authenticated request using the bearer token you would need to pass the token the way I mentioned it before. This is how I structured it in python,

As an example, here I retrieve the records associated with an object using a GET request,

In the above case, printing out the results of the GET request will return a JSON object with all the records associated with that object.

--

--

Thauren Heavyside

Cloud Data Engineer | Passionate about serverless and event driven architecture