Understanding Endpoint Actions

What are Endpoint Actions?

An action is an abstract description of an operation supported by the endpoint.

If an action’s endpoint is bound to a model, then it may request data underlying that model.

If an action’s endpoint is not bound to a model or not, then it may perform an another service instead that excludes data access.

Calling an Endpoint Action

Defining an action is by adding a functional request + query string parameters following the endpoint’s path:

  • Action name must be in lowercase, for example /find
  • Action result is transposed to JSON by adding .json
  • Required parameter for any action is either:
    • Account provided API Key (32 characters long string) and assigning it to Parameter api_key.
      For example: &api_key=aaaabbbbccccddddeeeeffffgggghhhh
    • Session token generated by /session/authenticate/api_key.json using account provided API Key and assigning it to Parameter session_token.
      For example: &session_token=00001111222233334444555566667777

Example MAT/API request with action and api_key:

Endpoint Action’s Parameters

An action’s parameters defines the request to be serviced by its controller.

The following are the action parameters for /account/users/find.json:

Action 'find' syntax diagram.

Endpoint Action’s Return

The return result for most actions is transposed into JSON. The following is the JSON result from /account/users/find.json:

  "status_code": 200,
  "response_size": "327",
  "data": [
      "country_id": 840,
      "region_id": 48,
      "id": 1587,
      "type": "company",
      "name": "HasOffers Demo Account",
      "address1": "2220 Western Ave.",
      "address2": "",
      "city": "Seattle",
      "zipcode": "98121",
      "phone": "206-508-11318",
      "website": "http://www.hasoffers.com",
      "verified_phone": false,
      "status": "active"
Have a Question? Please contact support@tune.com for technical support.