Swrve’s Custom REST API integration supports the following actions:
- Web service request to perform a custom REST call to one or more API endpoints.
Use the Custom REST API to connect any significant event (or set of events) in your user’s activity to a call to one of your backend services or to a third party service that exposes a REST API. Examples of how you might use this are:
- Logging an event or action in your systems to record an important user activity; for example, a fatal error in the app.
- Sending a confirmation of a user activity to your CRM system to update your internal records for that user. For example, logging a signup or notifying your systems that a user has completed a purchase.
- Routing a key activity of a user to a service like IFTTT or other automation systems to connect a user’s mobile activity with other automation tools you use to interact with the user.
Remember that the REST API calls can be fully personalized using the user data Swrve has gathered about the user and can be contextualized using information gathered from the triggering event.
Configuring a customer REST API
The Custom REST API does not include any pre-configuration. You configure the individual API endpoints when setting up a new rule.
This section describes the fields that are included when creating a new rule using the Webservice Request action. Most fields have the option to manually enter the value or to select a user property from the list to have Swrve automatically populate the value when the rule is processed.
To configure the API endpoints for a custom REST call:
Step 1: Select the rule trigger(s).
Step 2: Select Add Action, select Custom, and then select the Webservice Request action.
Step 3: Complete the following fields, as necessary:
|URL||The HTTP / HTTPS address and path expected by your server.|
|Method||The HTTP method. The action supports GET, POST, PUT, DELETE and HEAD methods.|
|Headers||The HTTP headers. These are custom key-value fields and depend on what your server expects. (Optional)|
|Body||The HTTP body. This is a custom field and depends on what your server expects. This field typically contains property substitutions, such as User ID. (Optional)|
|Multipart Form Post||If your server requires file upload-type data, multipart form post is supported. Typically this field is blank. (Optional)|
The Custom REST API action retries any failed request that returns a 5xx HTTP error, up to 300 times. The request is retried with back off with a maximum delay up to one hour between retries.
The Custom REST API action supports HTTPS. However, it does not support self-signed certificates.
A REST request is made each time the action is triggered. This means that a sudden spike in activity will result in sudden traffic spikes for the REST API. The URL configured in the action should be set up to accept spikes in traffic. These requests are not rate limited.
To test the Custom REST API configuration, use a service such as RequestBin or similar.