Trigger File Imports

This API can be used to trigger scheduled file imports. Periodic imports can be triggered to run using this API if the import has not expired and is in any of the following states: Scheduled, Successful, Partially Successful, and Failed.

API Endpoint

API Endpoint
https://fileimports-data-api-0X.moengage.com/v1.0/data/fileimports/trigger/{schedule_id}

The 'X' in the API Endpoint URL refers to the MoEngage Data Center (DC). MoEngage hosts each customer in a different DC. You can find your DC number (value of X) and replace the value of 'X' in the URL by referring to the DC and API endpoint mapping.

SCHEDULE_ID

Key Required Data Type Description

SCHEDULE_ID

Yes

String

This field specifies the Import ID(the unique identifier for the import) of the import that needs to be triggered. You can find the Import ID in the MoEngage Dashboard on the Imports History page. Click on Actions → View import to view the Import Details.

ImportDetails.png

You can also view the Import ID in the email notification received once the import has been set up.

Authentication

The API request will be authenticated through Basic Authentication. Basic Authentication sends a Base64-encoded string containing your username and password with every API request. It encodes a 'username:password' string in Base64 and appends the encoded string with 'Basic '. This string is included in the authorization header as shown below:

{"Authorization":"Basic bmF2ZWVua3VtYXI6bW9lbmdhZ2U="}

The username and password details can be obtained from the MoEngage Dashboard. We've revamped the settings UI in the Dashboard. If you're using the API for the first time, follow these steps for the revamped and old UIs:

Revamped UI

  1. Navigate to Settings -> Account -> APIs.
  2. Click Generate Key in the Data tile in the API Keys section, and click Save.
  3. Use the App ID as the username and the Data API Key as the password to generate the authentication header.

Old UI

  1. Navigate to Settings -> APIs -> DATA API Settings.
  2. Click Generate Key.
  3. Click Save on the Data APIs settings section. 
  4. Use the DATA API ID as the username and the DATA API KEY as the password to generate the authentication header.

Request Headers

Key Sample Values Description

MOE-APPKEY

{"MOE-APPKEY": "APP ID"}

This is your MoEngage account's APP ID that has to be passed along with the request.

You can find your MoEngage APP ID in the following navigation on the Dashboard:

Revamped UI: Settings -> Account -> APIs -> App ID

Old UI: Settings -> API -> General Settings -> DATA API

Authorization

{"Authorization": "Basic bmF2ZWVua3VtYXI6bW9lbmdhZ2U=="}

This authentication parameter, used for access control, must be passed along with the request. To generate the authentication header,, refer to Authentication.

Response

Key Data Type Description

status

String

This field contains the status of the request and specifies whether the request was successful. 

Supported Values: success, failure

Example: "status": "success"

message

String

This field contains information about whether the request was successful or not.

Example: 

"message": "Trigger Import Successful"

error_type

 

String

This field is present in the response when the Import/Schedule ID in the request is not found in the system (either because it is invalid or has been deleted).

type

String

This field is present in the response in the case of 403 errors and contains the error type.

request_id

String

This field is present in the response in the case of 403 errors and contains the request-id.

title

String

This field is present in the response in the case of errors and contains the type of error.

description

String

This field is present in the response in the case of errors and contains the error description.

code

String

This field is present in the response in the case of 5xx errors and contains the error code.

Response Codes

Status Code Request State Description

200

Success

This response is returned when the request is processed successfully. 

400

Bad Request

This response is returned when the Import ID/Schedule ID is missing from the request or when the provided parameters are invalid. Also, this response is returned when the rate limit (one request in five minutes) is breached.

401

Authorization Errors

This response is returned when the APP Key is invalid or missing, the password is incorrect, or there are other such authorization-related errors in the request.

403

Account Blocked

This response is returned when your MoEngage account has been blocked or suspended.

404

Not Found

This response is returned when the request contains the incorrect URL (when you try to access a resource that is not present).

405

Method Not Allowed

This response is returned when the request contains an unsupported method. For example, if you were to use the GET method instead of POST for this request, you would result in a 405 error.

5xx

Internal Server Error

This response is returned when the system runs into an unexpected error.

Rate Limit

This API can be triggered once in every five minutes for a specific schedule_id. A Bad request response (400) response will be sent if this is exceeded.

Sample cURL Request

cURL
curl --location --request POST 'https://fileimports-data-api-0X.moengage.com/v1.0/data/fileimports/trigger/{YOUR_IMPORT_ID_HERE}' \
--header 'MOE-APPKEY: YOUR_APP_KEY_HERE' \
--header 'Authorization Basic Base64_ENCODED_APPID_APISECRET==' \

Sample Response

200 400 401 403 404 405 500
Success Response
{ "status": "success", "message": "Triggered Import Successfully", }

Postman Collections

We have made it easy for you to test the APIs. Click here to view it in Postman. 

FAQs

  1. Does the trigger API change the import schedule?

    No, the schedule still remains the same as originally set up in the MoEngage Dashboard.

Previous

Next

Was this article helpful?
0 out of 0 found this helpful

How can we improve this article?