Post

2 followers Follow
0
Avatar

API Code Samples

Frank Hagan

Where can I get code samples for the ONTRAPORT API?

Answered

Official comment

Avatar

ONTRAPORT has a library of code samples on GitHub for the older API at https://github.com/Ontraport/ontra_api_examples.

For the new API, we have some online documentation. Obtain a API App ID and API Key from the account you are working in and visit our interactive API documentation at api.ontraport.com/doc. After entering the API App ID and API Key at the top you can create and test API calls.

To find the available objects in your account:

  1. Click the Objects section
  2. Open  GET /objects/meta
  3. Under Parameters > Format select byName
  4. Click the Try It Out! button.

 

 

The Response will include all of the objects you can access. For example, within the "data" array shown in the image below, the first string, "Contact" is the object name, and the "id": 0 attribute is the objectID for the Contact object (Contacts database).

 

 

All accounts will include the first ten objects in this table. Many more objects are listed in the response. In addition, some accounts have Custom Objects that generate dozens of object IDs for each one of their data elements.

 

Object Name Object ID
Contact 0
Task 1
Staff 2
Group 3
ContactLogEntry 4
Sequence 5
Rule 6
Message 7
Subscriber 8
Step 9

 

Support Requests

We cannot assist you in learning how to program using the API. But for those of you already coding, we are happy to help with specific questions about code you have written that is producing an error. Please include the code in a plain text file and attach it to an email to api@ontraport.com. Include a description of the error you are receiving. One of our developers will respond to your request during normal business hours. 

Frank Hagan
Comment actions Permalink

Please to leave a comment.

2 comments