Not logged in - Login
View History

REST API v1.0 - Function: Create a new task

REST API is the kernel of all our libraries.

Here we want to describe how you can make your first task using API.


API URL

https://api.atrigger.com/v1/tasks/create?
    key=APIKEY                     //required
    &secret=APISECRET              //required
    &timeSlice=1month              //required
    &count=12                      //required
    &tag_id=9999                   //semi-optional
    &url=http%3A%2F%2Fexample.com%2FmyTask%3Fquery%3Dsample          //required


All About Parameters

Some queries are required to create a task. More optional parameters are available for advanced usages. Also POST and GET requests to API has different meanings.

Keep in mind you should pass all parameter values URL Encoded.

Parameters: URL Queries

  1. Required key: Your API Key
  2. Required secret: Your API Secret
  3. Required timeSlice: When should be called? read more at timeSlice parameter.
  4. Required count: How many cycles should be repeated? read more at count parameter.
  5. Required url: The target url that A Trigger will call it at defined TimeSlice. MUST BE URL ENCRYPTED
  6. Semi-Optional tag_*: You need tag your tasks for future identification and to control them using API in the future. read more at tags_* parameters.
  7. [Optional] retries: How many times should try if your server failed(or it was down)? default value: 3
  8. [Optional] first: When should be the first call? You are not required to set time value by default. read more at first parameter.


Parameters: POST Data

This is an optional advanced feature. In a sentence: On task creation using API, Any data you are POSTing to "Create API URL", will be POSTed to your task URL at the time of fire.

You can forward details such as user information and useful data for your task as POST data to A Trigger API. This information will be passed to your task url at the time of fire.

  • Files and images will be ignored.
  • There are some size limits.
  • POST data should be well formated by Keys/Values.


Output / Result

All API requests will return a JSON result.

Example result when you have problem in your API Key/Secert:

{ "type": "ERROR", "message": "API Key/Secret is null." }

You can read more about the outputs at: http://atrigger.com/docs/wiki/11/rest-api-v10-outputs


Examples

You need to change the API Key, API Secret and URL in this examples.


Call http://example.com/myTask?query=sample each month at this day for a year:

https://api.atrigger.com/v1/tasks/create?key=APIKEY&secret=APISECRET&timeSlice=1month&count=11&url=http%3A%2F%2Fexample.com%2FmyTask%3Fquery%3Dsample&tag_type=testing


Call http://example.com/myTask?query=sample every 30 minutes for infinite times:

https://api.atrigger.com/v1/tasks/create?key=APIKEY&secret=APISECRET&timeSlice=30minute&count=-1&url=http%3A%2F%2Fexample.com%2FmyTask%3Fquery%3Dsample&tag_type=testing


Debug

All tasks will be listed in your panel at the moment of creation. Login to your panel and check all tasks available there.