Influitive Examples

Example 1

In this example, we will be making 2 GET requests and a POST request to first find the contact_id, check to see if they have been active, and if so award them a perk.

  1. Call the /members resource with the email parameter
    GET http://api-multi-request.demos.mikestowe.com/influitive/api/members?email=email@mycompany.net
  2. Retreive contact_id and call events resource with contact_id parameter
    http://api-multi-request.demos.mikestowe.com/influitive/api/events?contact_id=3
  3. If they have been active, send them a perk with the contact_id and a message in a JSON post body
    POST http://api-multi-request.demos.mikestowe.com/influitive/api/perks/reward/dnf9whr893nf39ih-fh89h4598fh4

To use the chain, we would simply make one call via POST, as such:


http://api-multi-request.demos.mikestowe.com/influitive/api/multirequest

[
  {
    "doOn": "always",
    "href": "/members?email=email@mycompany.net",
    "method": "get",
    "data": {},
    "return": true
  },
  {
    "doOn": "200",
    "href": "/events?contact_id=${body[0].id}",
    "method": "get",
    "data": {},
    "return": true
  },
  {
    "doOn": "${body.events}",
    "href": "/perks/reward/dnf9whr893nf39ih-fh89h4598fh4",
    "method": "post",
    "data": {"contact_id" : "${body.events[0].contact_id}", "message" : "Great job!"},
    "return": true
  }
]