My APIs are custom HTTP endpoints built directly in integrator.io, which client applications can invoke. They are simply custom-made endpoints. Usually, integrator.io initiates a transfer between applications; however, with My API, integrator.io receives a request from an external application to trigger a flow, export, or import. The external application sends a synchronous request and receives a response from My API. My API also uses synchronous requests to invoke exports and imports. Flows invoked from your My API script don't guarantee immediate flow execution. This function ensures that the flow is added to the execution queue. My API logs, errors, and dashboards are not updated. My API is also the only integrator.io resource that supports returning a response in a format other than JSON.
Note: My API functions can be used to invoke the resources within a custom integration. However, you can’t use them to invoke Integration Apps or resources within Integration Apps.
With My API, integrator.io receives a request from Shopify to trigger an import or export that makes NetSuite perform a task. For example, Shopify can send a My API request that invokes an import to create an invoice in NetSuite. In this case, integrator.io didn’t initiate the request; they received it from Shopify.
My API is useful when initiating integration tasks like
- Syncing a newly released Empower change order into NetSuite.
- Getting ShipWorks order information from external systems on demand.
- Returning an immediate response to a Slackbot (via synchronous processing).
Before you can trigger a My API endpoint, you’ll need to create a My API and get a bearer token. Then, you can call the My API from your desired applications.
The integrator.io API is rate-limited using a leaky-bucket algorithm with a bucket size of 1,000 and a fill rate of 300 tokens every second, allowing up to approximately 1,080,000 requests per hour.
Create a My API object
You must enable Developer mode to access My APIs and their associated tokens. Then, you can create, modify, or delete the My APIs in the Resources menu.
To create a My API:
- Navigate to Resources → My APIs.
- Click + Create My API on the upper right-hand side of the screen.
- Enter a unique Name and detailed Description of how the My API works. Be sure to highlight any nuances you or another user making changes might want to know later.
- Scripts (required): Select a script from the list that you’ve already written, click the + icon to start writing your own code in the Create script form, or modify an existing script using the pencil () icon. If you’re starting from scratch, insert a function stub that provides all the required fields for the request and response. Note that if you modify a script in one location, it is modified everywhere.
Tip: Within your script logic, you can support any content type (like JSON or XML), any HTTP request method (GET, PUT, POST, etc.), and you can invoke any number of external APIs. The built-in JS runtime module contains several objects and functions you can script and automate everyday integrator.io tasks.
- Function (required): Enter the name of the function. This is the function name that gets called when a request is sent to My API; although you can write as much code as you need, only the single entry point specified here is initially called and receives any data passed in the HTTP header and body.
The name of the function in the default Handle request stub is
handleRequest. If you used a different name, you may find it easiest to click the icon to open the script for editing and copy the exact name (without parentheses) for this Function setting.
- Enable ShipWorks authentication (optional): Check this box if you will be receiving HTTP requests from ShipWorks, so that integrator.io provides the required login credentials.
Username (enabled & required, only for authentication): Enter the ShipWorks username you provided during the store setup.
Password (enabled & required, only for authentication): Enter the ShipWorks password you provided during the store setup. Multiple layers of protection are in place, including AES 256 encryption, to keep your password secure. When editing this form later, you must enter this password again; it is stored only for a saved My API.
Copy your unique endpoint URI
Click the name of a My API in the list or choose Actions… > Edit My API. Then, click Copy URLto add the contents to your clipboard.
These values are displayed earlier when you click Save in the Create My API pane, instead of closing when done.
Provide the username and password in your request for authentication – no bearer token is required