NAV
curl Node.js

Introduction

Welcome to the elastic.io REST API!

Authentication

You authenticate to the elastic.io API by providing your API key in the request.

Authentication to the API occurs via HTTP Basic Auth. Provide your email as the basic auth username and API key as the password.

curl https://api.elastic.io/v1/users \
   -u {EMAIL}:{APIKEY}
var client = require('elasticio-rest-node')(
    'YOUR_EMAIL', 'YOUR_API_KEY'
);

Credentials

Get all credentials available for the user

Example Request:

curl https://api.elastic.io/v2/credentials/?filter[component]={COMPONENT_ID} \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'
// TBD

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "meta": {},
    "data": [
        {
            "id": "585430d3f02852a8a9fac45e",
            "type": "credential",
            "attributes": {
                "name": "CMS primary",
                "keys": {
                    "oauth": {
                        "key": "secret1"
                    }
                }
            },
            "relationships": {
                "user": {
                    "data": {
                        "id": "585430d3f02852a8a9fac45d",
                        "type": "user"
                    },
                    "links": {
                        "self": "/v2/users/585430d3f02852a8a9fac45d"
                    }
                },
                "component": {
                    "data": {
                        "id": "585430d2f02852a8a9fac456",
                        "type": "component"
                    },
                    "links": {
                        "self": "/v2/components/585430d2f02852a8a9fac456"
                    }
                }
            }
        },
        {
            "id": "585430d3f02852a8a9fac45f",
            "type": "credential",
            "attributes": {
                "name": "Refined CRM Manager login",
                "keys": {
                    "oauth": {
                        "key": "secret2"
                    },
                    "allowOption": "enabled"
                }
            },
             "relationships": {
                 "user": {
                     "data": {
                         "id": "585430d3f02852a8a9fac45d",
                         "type": "user"
                     },
                     "links": {
                         "self": "/v2/users/585430d3f02852a8a9fac45d"
                     }
                 },
                 "component": {
                     "data": {
                         "id": "585430d2f02852a8a9fac457",
                         "type": "component"
                     },
                     "links": {
                         "self": "/v2/components/585430d2f02852a8a9fac457"
                     }
                 }
             }
        }
    ]
}

This endpoint retrieves a list of credentials available for the user

HTTP Request

GET https://api.elastic.io/v2/credentials/

URL Parameters

Parameter Required Description
filter[component] no Only credentials belong to the given component id

Returns

Returns a list of credentials if the call succeeded.

Get a credential

Example Request:

curl https://api.elastic.io/v2/credentials/{CREDENTIAL_ID}/ \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'
//TBD

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "meta": {},
    "data": {
        "id": "585430d3f02852a8a9fac45e",
        "type": "credential",
        "attributes": {
            "name": "CMS primary",
            "keys": {
                "oauth": {
                    "key": "secret1"
                }
            }
        },
        "relationships": {
            "user": {
                "data": {
                    "id": "585430d3f02852a8a9fac45d",
                    "type": "user"
                },
                "links": {
                    "self": "/v2/users/585430d3f02852a8a9fac45d"
                }
            },
            "component": {
                "data": {
                    "id": "585430d2f02852a8a9fac456",
                    "type": "component"
                },
                "links": {
                    "self": "/v2/components/585430d2f02852a8a9fac456"
                }
            }
        }        
    }
}

This endpoint retrieves one of a credential available for the user

HTTP Request

GET https://api.elastic.io/v2/credentials/{CREDENTIAL_ID}/

URL Parameters

Parameter Description
CREDENTIAL_ID The ID of the credential

Returns

Returns a credential object if the call succeeded.

Add a new credential

Example Request:

curl https://api.elastic.io/v2/credentials/ \
    -u {EMAIL}:{APIKEY} \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json' -d '
    {
        "data": {
            "type": "credential",
            "attributes": {
                "name": "Spreadsheet",
                    "keys": {
                        "oauth": {
                            "key": "secret1"
                        }
                }
            },
            "relationships": {
                "component": {
                    "data": {
                        "id": "585430d2f02852a8a9fac456",
                        "type": "component"
                    }
                }
            }
        }
    }'
//TBD

Example Response:

HTTP/1.1 201 Created
Content-Type: application/json

{
   "data": {
       "id": "585430d3f02852a8a9fac45e",
       "type": "credential",
       "attributes": {
           "name": "CMS primary",
           "keys": {
               "oauth": {
                   "key": "secret1"
               }
           }
       },
        "relationships": {
            "user": {
                "data": {
                    "id": "585430d3f02852a8a9fac45d",
                    "type": "user"
                },
                "links": {
                    "self": "/v2/users/585430d3f02852a8a9fac45d"
                }
            },
            "component": {
                "data": {
                    "id": "585430d2f02852a8a9fac456",
                    "type": "component"
                },
                "links": {
                    "self": "/v2/components/585430d2f02852a8a9fac456"
                }
            }
        }         
   }
}

This endpoint allows to create a new credential

HTTP Request

POST https://api.elastic.io/v2/credentials/

Arguments

Parameter Required Description
type yes A value should be “credential”
attributes.name no Credential name. An automatic name will be generated if the parameter is omitted
relationships.component.data.id yes The component id this credential is for
relationships.component.data.type yes A value should be “component”
attributes.keys no An object which represents component’s configuration (OAuth keys, etc.)

Returns

Returns credential object if the call succeeded.

Modify a credential

Example Request:

curl https://api.elastic.io/v2/credentials/{CREDENTIAL_ID}/ \
   -u {EMAIL}:{APIKEY} \
   -X PATCH \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
    {
        "data": {
            "id": "585430d3f02852a8a9fac45e",
            "type": "credential",
            "attributes": {
                "keys": {
                    "key1": "updated value"  
                }
            }             
        }
    }'
//TBD

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
   "data": {
       "id": "585430d3f02852a8a9fac45e",
       "type": "credential",
       "attributes": {
           "name": "CMS primary",
           "keys": {
                "key1": "updated value"
           }
       },
        "relationships": {
            "component": {
                "data": {
                    "id": "585430d2f02852a8a9facaaa",
                    "type": "component"
                },
                "links": {
                    "self": "/v2/component/585430d2f02852a8a9facaaa"
                }                
            },
            "user": {
                "data": {
                    "id": "585430d3f02852a8a9fac45d",
                    "type": "user"
                },
                "links": {
                    "self": "/v2/users/585430d3f02852a8a9fac45d"
                }
            }
        }              
   }
}

This endpoint modifies credential

### HTTP Request

`PATCH https://api.elastic.io/v2/credentials/{CREDENTIAL_ID}/`

### URL Parameters

Parameter  | Description
---------- | -----------
CREDENTIAL_ID | The ID of the credential


### Arguments

Parameter | Required | Description
--------- | ----------- | -----------
id | yes | A value should be the same as URL paramether CREDENTIAL_ID
type | yes | A value should be "credential"
attributes.name | no | Credential name. Will remain untouched if value omitted.
attributes.keys | no | An object which represents component's configuration. Will remain untouched if value omitted. Please note, that "keys" object is overwritten entirely.


### Returns

Returns a modified credential object if the call succeeded.

Flows

Retrieve all flows

Example Request:

 curl https://api.elastic.io/v2/flows \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json'
TBD

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": [
        {
            "type": "flow",
            "id": "585918da586224001b96de89",
            "attributes": {
              "name": "Timer to E-Mail Test",
              "status": "inactive",
              "type": "ordinary",
              "graph": {
                "nodes": [
                  {
                    "id": "step_1",
                    "command": "elasticio/timer:timer",
                    "fields": {
                      "interval": "minute"
                    }
                  },
                  {
                    "id": "step_2",
                    "command": "elasticio/email:send"
                  }
                ],
                "edges": [
                  {
                    "source": "step_1",
                    "target": "step_2",
                    "config": {
                      "mapper": {
                        "to": "info@acme.org",
                        "subject": "Test",
                        "textBody": "{{fireTime}}"
                      }
                    }
                  }
                ]
              }
            },
            "relationships": {
              "user": {
                "data": {
                  "type": "user",
                  "id": "560e5a27734d480a00000002"
                },
                "links": {
                  "self": "/v2/users/560e5a27734d480a00000002"
                }
              },
              "organization": {
                "data": {
                  "type": "organization",
                  "id": "573dd76962436c349f000003"
                },
                "links": {
                  "self": "/v2/organizations/573dd76962436c349f000003"
                }
              }
            }
        }
    ],
    "meta": {
        "page": 1,
        "per_page": 50,
        "total": 1,
        "total_pages": 1
    }

}

This endpoint retrieves all flows for user or organization

HTTP Request

GET https://api.elastic.io/v2/flows/

Returns

Returns all flows belonging to user or organization.

Retrieve a flow by ID

Example Request:

curl https://api.elastic.io/v2/flows/{FLOW_ID} \
   -u {EMAIL}:{APIKEY}
TDB

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "type": "flow",
    "id": "585918da586224001b96de89",
    "attributes": {
      "name": "Timer to E-Mail Test",
      "status": "inactive",
      "type": "ordinary",
      "graph": {
        "nodes": [
          {
            "id": "step_1",
            "command": "elasticio/timer:timer",
            "fields": {
              "interval": "minute"
            }
          },
          {
            "id": "step_2",
            "command": "elasticio/email:send"
          }
        ],
        "edges": [
          {
            "source": "step_1",
            "target": "step_2",
            "config": {
              "mapper": {
                "to": "info@acme.org",
                "subject": "Test",
                "textBody": "{{fireTime}}"
              }
            }
          }
        ]
      }
    },
    "relationships": {
      "user": {
        "data": {
          "type": "user",
          "id": "560e5a27734d480a00000002"
        },
        "links": {
          "self": "/v2/users/560e5a27734d480a00000002"
        }
      },
      "organization": {
        "data": {
          "type": "organization",
          "id": "573dd76962436c349f000003"
        },
        "links": {
          "self": "/v2/organizations/573dd76962436c349f000003"
        }
      }
    }
  },
  "meta": {}
}

This endpoint returns a flow for given ID

HTTP Request

GET https://api.elastic.io/v2/flows/{FLOW_ID}

URL Parameters

Parameter Description
FLOW_ID The ID of the flow to retrieve

Returns

The flow with given ID

Create a flow

Example Request:

 curl https://api.elastic.io/v2/flows \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
    {
      "data": {
        "type": "flow",
        "attributes": {
          "name": "Timer to E-Mail",
          "status": "inactive",
          "type": "ordinary",
          "graph": {
            "nodes": [
              {
                "id": "step_1",
                "command": "elasticio/timer:timer",
                "fields": {
                  "interval": "minute"
                }
              },
              {
                "id": "step_2",
                "command": "elasticio/email:send"
              }
            ],
            "edges": [
              {
                "source": "step_1",
                "target": "step_2",
                "config": {
                  "mapper": {
                    "to": "info@acme.org,
                    "subject": "Test",
                    "textBody": "{{fireTime}}"
                  }
                }
              }
            ]
          }
        }
      }
    }'
TBD

Example Response:

HTTP/1.1 201 Created
Content-Type: application/json

{
  "data": {
    "type": "flow",
    "id": "585918da586224001b96de89",
    "attributes": {
      "name": "Timer to E-Mail Test",
      "status": "inactive",
      "type": "ordinary",
      "graph": {
        "nodes": [
          {
            "id": "step_1",
            "command": "elasticio/timer:timer",
            "fields": {
              "interval": "minute"
            }
          },
          {
            "id": "step_2",
            "command": "elasticio/email:send"
          }
        ],
        "edges": [
          {
            "source": "step_1",
            "target": "step_2",
            "config": {
              "mapper": {
                "to": "info@acme.org",
                "subject": "Test",
                "textBody": "{{fireTime}}"
              }
            }
          }
        ]
      }
    },
    "relationships": {
      "user": {
        "data": {
          "type": "user",
          "id": "560e5a27734d480a00000002"
        },
        "links": {
          "self": "/v2/users/560e5a27734d480a00000002"
        }
      },
      "organization": {
        "data": {
          "type": "organization",
          "id": "573dd76962436c349f000003"
        },
        "links": {
          "self": "/v2/organizations/573dd76962436c349f000003"
        }
      }
    }
  },
  "meta": {}
}

This endpoint creates a flow for current user or his organization

HTTP Request

POST https://api.elastic.io/v2/flows/

Arguments

Parameter Required Description
type yes A value should be “flow”
attributes.name yes Flow name
attributes.status yes Flow status. May be any of: active, inactive
attributes.type yes Flow type. May be any of: ordinary, long_running
attributes.graph yes Flow graph representing component connections

Returns

Returns the created flow

Lookup tables

Get lookup tables

Lists available lookup tables

Example Request:

 curl https://api.elastic.io/v2/lookups \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'

Example Response:


{
    "data": [{
        "type": "lookup",
        "id": "5863f65ecc753f2441c88e68",
        "attributes": {
            "title": "lookup title",
            "data": {
              "key": "value"
            }
        },
        "relationships": {
            "user": {
                "data": {
                    "type": "user",
                    "id": "585d389b90ea62ce348a478b"
                },
                "links": {
                    "self": "/v2/users/585d389b90ea62ce348a478b"
                }
            },
            "organization": {
                "data": {
                    "type": "organization",
                    "id": "58400dc7c9ab5757f8ef1f81"
                },
                "links": {
                    "self": "/v2/organizations/58400dc7c9ab5757f8ef1f81"
                }
            }
        }
    }],
    "meta": {}
}

Create lookup table

Example Request:

 curl https://api.elastic.io/v2/lookups \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
   {
      "data": {
          "type": "lookup",
          "attributes": {
              "title": "lookup example",
              "data": {
                  "key": "value"
              }
          }
      }
   }'
 TBD

Example Response:

{
    "data": {
        "type": "lookup",
        "id": "5863f7136ef9da255ad9a9bc",
        "attributes": {
            "title": "mylookuptitle",
            "data": {
                "key": "value"
            }
        },
        "relationships": {
            "user": {
                "data": {
                    "type": "user",
                    "id": "585d389b90ea62ce348a478b"
                },
                "links": {
                    "self": "/v2/users/585d389b90ea62ce348a478b"
                }
            },
            "organization": {
                "data": {
                    "type": "organization",
                    "id": "58400dc7c9ab5757f8ef1f81"
                },
                "links": {
                    "self": "/v2/organizations/58400dc7c9ab5757f8ef1f81"
                }
            }
        }
    },
    "meta": {}
}
Parameter Required Description
title yes Lookup table name
data yes key/value

Update Lookup table

Parameter Required Description
title yes Lookup table name
data yes key/value

Example Request:

 curl https://api.elastic.io/v2/lookups/{LookupId} \
   -XPUT \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
   {
      "data": {
          "type": "lookup",
          "id": "{LookupId}",
          "attributes": {
              "title": "new lookup title",
              "data": {
                  "key": "value"
              }
          }
      }
   }'
 TBD

Remove lookup table

Example Request:

 curl https://api.elastic.io/v2/organizations/{LookupId} \
    -XDELETE    \
    -u {EMAIL}:{APIKEY}'
 TBD

Example Response:

HTTP/1.1 204 No Content

Organizations

Create organization

Example Request:

 curl https://api.elastic.io/v2/organizations \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
   {
       "name": "My Org",
       "members": [
            {
                "email": "test@email.com",
                "role": "admin"
            }
       ]
   }'
 TBD

Example Response:

{ 
  "data":
    { 
      "id": "58455777a0aec4f377faefc1",
      "type": "organization",
      "attributes": { 
        "name": "My Org"
      } 
   },
  "meta": {} 
}

this request requires user to be tenant admin

Parameter Required Description
name yes Organization name
members no Array of objects with email and role keys
members.email yes User’s email
members.role no User’s role, may be ‘admin’, 'integrator’ or 'guest’

Returns

Returns Organization object if the call succeeded

Remove member from organization

Example Request:

 curl https://api.elastic.io/v2/organizations/{OrganizationId}/members/{UserId} \
    -XDELETE    \
    -u {EMAIL}:{APIKEY}'
 TBD

Example Response:

HTTP/1.1 200 OK

Operation requires organization admin access. Ownership of user’s Flows, Credentials, Lookups and Teams would be transferred to admin User performing this operation.

Returns

Request returns 200 OK status code and empty body if succeeded.

Users

Retrieve your user

Example Request:

curl https://api.elastic.io/v2/users/me \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'
//TBD

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": {
        "id": "54f4be3fe7d5224f91000001",
        "type": "user",
        "attributes": {
            "first_name": "John",
            "last_name": "Doe",
            "email": "test@example.com"
        }
    }
}

This endpoint returns your own user.

HTTP Request

GET https://api.elastic.io/v2/users/me

Returns

Returns a user object if the call succeeded.

Get a certain user

Example Request:

curl https://api.elastic.io/v2/users/{USER_ID} \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json'
//TBD

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": {
        "id": "54f4be3fe7d5224f91000002",
        "type": "user",
        "attributes": {
            "first_name": "John",
            "last_name": "Doe",
            "email": "test@example.com"
        }
    }
}

This endpoint returns requested user if the call succeeded. This request is authorized for a member of an organization or for a user with a role as TenantAdmin.

HTTP Request

GET https://api.elastic.io/v2/users/{USER_ID}

URL Parameters

Parameter Description
USER_ID The ID of a user

Returns

Returns a user object if the call succeeded.

Create a user

Example Request:

curl https://api.elastic.io/v2/users \
   -u {EMAIL}:{APIKEY} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
    {
        "data": {
            "type": "user",
            "attributes": {
                "first_name": "John",
                "last_name": "Doe",
                "email": "test@example.com",
                "password": "secret",
                "company": "Doe & Partners"
            }
        }
    }'
//TBD

Example Response:

HTTP/1.1 201 Created
Content-Type: application/json

{
    "data": {
        "id": "54f4be3fe7d5224f91000001",
        "type": "user",
        "attributes": {
            "first_name": "John",
            "last_name": "Doe",
            "email": "test@example.com",
            "company": "Doe & Partners"
        }
    }
}

This endpoint registers a new user. This request is authorized only for a user with TenantAdmin role.

HTTP Request

POST https://api.elastic.io/v2/users

Arguments

Parameter Required Description
attributes.first_name yes The user’s first name
attributes.last_name yes The user’s last name
attributes.email yes The user’s email
attributes.password yes The user’s password. Must be at least 8 characters long.
attributes.company no The user’s company

Returns

New user objects will be provided with an id field - this value cannot be created or edited by clients.