Auto-Generating_API_Code

We offer a few shortcut options for API users to auto-generate API calls, without having to go through the full documentation or manually construct the code syntax.

Using the API Documentation in Interactive mode

The API Documentation pages on this site offer an interactive mode where users can click on their selected criteria and the API call with the correct syntax will be auto-generated for them.
Follow these steps to switch to the interactive mode:
  1. Go to the method in the documentation that you want to test, e.g. /series/search
  2. Click on the “Authorize” button at "API Query Builder" section on the left side and enter your API key to get access to the interactive mode<
    image
    image
  3. Select all relevant parameters you want to include in your API query and click on "Add Parameter" button
    image
  4. Set values to the selected parameters and click on "Execute” button
    image
  5. You will get on the screen your API request HTTPS URl, as well as the response from this call
    image

Auto-generating API calls on CEIC Online data platform

Users who prefer to use the CEIC online platform CDMNext for auto-generating API calls can do that using the copy-to-clipboard (CTC) options on the platform for search and series retrieval queries.

Watch this video for a quick demo of CDMNext CTC options for API or check the steps below.

Steps to auto-generate API series search code, using the CDMNext Search section CTC options:

  1. Input the search keyword / Series ID(s) / SR codes
  2. Apply any filter of function to the search result
    image
  3. Click on the drop down arrow and select the desired API type
    image
  4. Paste (CTR+V) the auto-generated code in your selected environment to perform the same search there.

Steps to auto-generate API series search code, using the CDMNext Search section CTC options:

  1. Select the series you want
  2. Click "Download"
  3. Navigate to "Series" tab
  4. Select the API option
  5. Select the "API Type" (HTTP request, Python, PHP or JavaScript SDK)
  6. Select the "Missing observations" type - skip the observations with no value or leave them as blank
  7. Select the "Response format" (JSON, XML or CSV) - the format in which to download the data; this is available only if "http request" is selected in step #5
    image
  8. Paste (CTR+V) the auto-generated code in your selected environment to retrieve the series there

Steps to auto-generate API insights retrieval code, using CDMNext Download section CTC options:

  1. Select the insight you want
  2. Click "Download"
  3. Navigate to "Views" tab
  4. Select the API option
  5. Select the "API Type" (HTTP request, Python, PHP or JavaScript SDK)
  6. Select the "Response format" (PDF or XLSX) - the format in which to retrieve the insight - only full insight documents can be retrieved
    image
  7. Paste (CTR+V) the auto-generated code in your selected environment to retrieve the series there

Using Query Builder

Using Copy-to-Clipboard option

Explore in API Portal