This document describes the Irwin V1 Public API. This API is primarily intended for partners to develop integrations with our system. To use this API you must have an account with Irwin, learn more at www.getirwin.com
When using the code samples, requests should be sent with a Content-type of
application/json
.
The Irwin API implements the Command Query Responsibility Segregation (CQRS) pattern at the core of it's API design. While this pattern can be intimidating for some it does have many advantages, namely that it significantly improves our ability to deal with unpredictable spikes of activity. To oversimplify this pattern we will service modify the state of the system (otherwise known as mutations) asynchronously.
Mutation requests (also known as Command requests) typically are those which do not query data. Queries tend to be requests which get, list, search or fetch data from the system. Mutations tend to be creates, updates, deletions and business logic.
For several integrations which simply want to push data into the Irwin system this should be relatively simple to implement. Command requests can be issued and forgotten about. The status of the command can periodically be checked later after a reasonable amount of time has passed. For more complex workflows it may be necessary to wait for a command to complete before making a new one. For these cases we will offer a number of solutions via our Command endpoints which should help in these cases.
For every request it is required to set the X-Irwin-Customer-Id
header in order
to explicitly determine which customer account the request is intended for. The
value of this header must be the ID of the customer account you wish to operate
upon.
You can retrieve a list of the customer accounts you have permission to operate upon using the Get Current User endpoint. This endpoint is the only endpoint which does not require the header to be set.
If this header is not included an HTTP 400
response will be returned indicating
this header must be sent.
Providing an incorrect or unauthorized value to this header will result in an
HTTP 403
response.
Returns the current status of the identified command.
id required | string <uuid> ID of the Command |
{- "data": {
- "id": "00e6b146-52a8-49ae-a3b9-3313b902125f",
- "type": "command",
- "attributes": {
- "status": "queued",
- "enqueued_at": "2019-08-24T14:15:22Z",
- "started_at": "2019-08-24T14:15:22Z",
- "finished_at": "2019-08-24T14:15:22Z"
}, - "links": {
- "self": "/v1/commands/00e6b146-52a8-49ae-a3b9-3313b902125f"
}
}
}
Writes a command to eventually create a new engagement with an entity in the Irwin system. The command ID is returned which can be queried in the various Command endpoints.
An Engagement is a record of activity that some kind of entity took that would be of interest to users of the IRM. The list of engagement types is strictly defined but more cases can be added over time.
command_id | string <uuid> (CommandID) Optional unique identifier for the transaction used for idempotence. If this value is submitted multiple times an HTTP 409 will be returned indicating the command has already been enqueued. |
Person Matcher (object) | |
Email Subscription (object) or Email Unsubscribed (object) or Event Attended (object) |
{- "command_id": "7d510d78-7444-4252-aeac-9e473949661e",
- "entity": {
- "type": "person",
- "tags": [
- "Newsletter Subscriber"
], - "match": {
- "email": "user@example.com"
}, - "create": {
- "first_name": "John",
- "last_name": "Doe",
- "phone_number": "+1 (555) 555-5555",
- "job_title": "CEO",
- "address": {
- "street": "89 East 42nd Street",
- "street2": "Suite 100",
- "city": "New York",
- "state": "NY",
- "country": "US",
- "postal_code": "10017"
}, - "data": { }
}
}, - "engagement": {
- "type": "email_subscribed",
- "time": "2019-08-24T14:15:22Z",
- "email": "user@example.com",
- "all_lists": false,
- "lists": [
- {
- "id": "string",
- "name": "string"
}
], - "data": { }
}
}
{- "data": {
- "id": "00e6b146-52a8-49ae-a3b9-3313b902125f",
- "type": "command",
- "attributes": {
- "status": "queued",
- "enqueued_at": "2019-08-24T14:15:22Z",
- "started_at": "2019-08-24T14:15:22Z",
- "finished_at": "2019-08-24T14:15:22Z"
}, - "links": {
- "self": "/v1/commands/00e6b146-52a8-49ae-a3b9-3313b902125f"
}
}
}
Writes a command to eventually match an entity in the Irwin database or create a new entity in the user's IRM. The command ID is returned which can be queried in the various Command endpoints.
command_id | string <uuid> (CommandID) Optional unique identifier for the transaction used for idempotence. If this value is submitted multiple times an HTTP 409 will be returned indicating the command has already been enqueued. |
Person Matcher (object) |
{- "command_id": "7d510d78-7444-4252-aeac-9e473949661e",
- "entity": {
- "type": "person",
- "tags": [
- "Newsletter Subscriber"
], - "match": {
- "email": "user@example.com"
}, - "create": {
- "first_name": "John",
- "last_name": "Doe",
- "phone_number": "+1 (555) 555-5555",
- "job_title": "CEO",
- "address": {
- "street": "89 East 42nd Street",
- "street2": "Suite 100",
- "city": "New York",
- "state": "NY",
- "country": "US",
- "postal_code": "10017"
}, - "data": { }
}
}
}
{- "data": {
- "id": "00e6b146-52a8-49ae-a3b9-3313b902125f",
- "type": "command",
- "attributes": {
- "status": "queued",
- "enqueued_at": "2019-08-24T14:15:22Z",
- "started_at": "2019-08-24T14:15:22Z",
- "finished_at": "2019-08-24T14:15:22Z"
}, - "links": {
- "self": "/v1/commands/00e6b146-52a8-49ae-a3b9-3313b902125f"
}
}
}
This endpoint will return useful information about the user identified by the access token.
{- "data": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "type": "user",
- "attributes": {
- "first_name": "John",
- "last_name": "Doe"
}, - "relationships": {
- "customers": [
- {
- "data": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "type": "customer"
}
}
]
}
}, - "included": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "type": "customer",
- "attributes": {
- "name": "ACME Inc."
}
}
]
}