Happy Business Starts Here

Highlighted
Tutor

Entire Orders JSON documentation?

Is there JSON of all fields that can be sent as a POST to the v1/orders API call?

 

Trying to cobble together the entire JSON from the various examples is difficult with the current API documentation.

 

I specifically need the newAccount JSON, and all of the options that I can put into the createSubscription OrderAction.

 

Having the entire JSON available will make it a lot easier for developers to create classes to instantiate the API calls.

Tags (3)
2 REPLIES 2
Zuora Documentation

Re: Entire Orders JSON documentation?

Hi DMeseroll,

 

In the API docs, we don't directly provide a JSON version of all the fields that you can set when calling POST /v1/orders. However, there is a way that you can get this from the API docs.

 

NOTE: As of November 2018, this method does not show every single field in the JSON. Please see the next reply for an alternative method.

 

The API docs that you see at https://www.zuora.com/developer/api-reference/ is generated from a specification that we have created for the Zuora REST API. Our specification conforms to an open standard, called the Swagger standard.

 

To get the JSON you're looking for, you can first load our Swagger specification into a third-party API doc viewer such as https://api-docs.io/. I've just done that, and you can view the result here: https://zuora-api-reference-3.api-docs.io/2018-07-05/v1/create-order

 

Once you're viewing the POST /v1/orders docs at https://api-docs.io/, switch to the Try it out tab:

 

Screen Shot 2018-07-10 at 3.00.22 PM.png

 

Then you can see the entire JSON in the Request Body section:

 

Screen Shot 2018-07-10 at 3.02.18 PM.png

 

Is this what you're looking for? Let me know if I can explain anything in more detail.

 

By the way - it sounds like you're already well aware of this, but just to confirm, you wouldn't want to set all of these fields when calling POST /v1/orders. Some fields are only applicable to certain use cases and must not be set if other fields are set. The samples in Orders Tutorials show JSON requests for different use cases.

Zuora Documentation

Re: Entire Orders JSON documentation?

Hi @DMeseroll,

 

We recently discovered that the "Try it out" JSON at https://api-docs.io/ does not contain every single field. Apologies for any inconvenience this may have caused you. I'll raise the bug with the company that provides the API doc viewer.

 

As an alternative to using https://api-docs.io/, it's now possible to see the entire JSON inside Postman. Here's how:

 

  1. Download the Postman collection from this Community post, or use this Swagger converter to generate an up-to-date Postman collection.

     

  2. In Postman, navigate to File > Import, then choose the file that you downloaded or generated.

     

    You’ll then see a collection called “Zuora REST API (2018-11-15)”, or similar, in the sidebar:

     

    postman_zuora_collection_sidebar.png

     

  3. Navigate to v1 > orders > Create order, then click Examples and select All request body fields:

     

    postman_zuora_create_order.png

     

  4. In the EXAMPLE REQUEST section, select the Body tab:

     

    postman_zuora_create_order_all_fields.png

     

    You’ll then see entire JSON for the request body.

     

The entire JSON in Postman includes the fields that might have been missing at https://api-docs.io/. The entire JSON in Postman also includes fields called *, which represent custom fields of various objects.

 

Hopefully this method works well for you. Please let me know if you run into any issues.