Skip to content
English
  • There are no suggestions because the search field is empty.

Sending Events to the API

Spinify is designed so that objects and fields can be added easily by sending all data to Spinify using the Events endpoint.

Events are records in your custom application that are related to Spinify objects and are either newly created or have changed since the previous instance of the record was uploaded to Spinify.  Events trigger the update of Spinify Competitions. 

Event Record

The same endpoint and message will be sent when a record is created, edited, or deleted.  However, the data associated with the record will change to state the value of the record.

For more information on Event Records, see: API Record Details

Field Formats

All Date and DateTime fields must be in UTC format with the UTC designator (“Z”) also known as the ISO 8601 format.

Example:
Date: 2017-10-12
Date & Time in UTC: 2017-10-12T18:51:53.000Z

Endpoint

Use your API key to post events to https://api.spinify.com/v1/events

How To Post Events

Request

Each type of Record has its own unique set of fields that may be required and may have slightly different data types.

The unique set of fields goes into a sub-object called “Data”.  Other fields that are required are the following:

  1. All posts to Events must have the object in an array. You can send multiple records being created, updated, or deleted at one time.
  2. Type: This is should be the Spinify Type. The type of event being added. Allowed values are "Deal", "Call", "Email", "Meeting", "Account", "Lead", "TrailingRevenue", “Case”.
  3. RecordUrl: this is optional. If there’s a Url that can be built to automatically go to the Record please include the Url. This will be made available to users to access the record from Spinify.
  4. ExternalOrgId: should be set to “local” for the API.
  5. EventID: this needs to be a unique value every time a Record is Created/Updated/Deleted. Spinify recommends string with the DateTime since the Unix Epoch. 
[{
  "Type":"Lead",
  "RecordUrl":"http://example.com/recordid",
"ExternalOrgId":"local",
"EventID":"uniquerandomvalue",
  "Data": {
    insert unique fields for the Type specified.
    see: https://help.spinify.com/hc/en-us/sections/360004004752-Spinify-API
  }
}]

Response

Response Code: 200

  • Everything potentially went fine. You should check the array body to confirm that all elements were inserted correctly though.
  • Body is an Array of Results that looks like this:
[
 {
  "EventID": "uniqueIDpassedin",
  "Type": "Lead",
  "Status": "Success",
  "ErrorCodes": ""
 },
 {
  "EventID": "uniqueIDpassedin",
  "Type": "Lead",
  "Status": "Failed",
  "ErrorCodes": "Required Field Missing: Name"
 }
]

Sometimes, we may send a 200, but the Status is set to "Failed" and the ErrorCode will say that the Record is Outdated.  It will look like this:

{
    "Events": [
        {
            "Type": "Lead",
            "EventID": "UniquelyGeneratedValue3",
            "Status": "Failed",
            "ErrorCodes": "Record with Id UniquelyGeneratedValue3 is outdated"
        }
    ]
}

This means that we may already have this record based on the Updated date that you have provided.

Response Code: 401

  • Unauthorized. 
  • Your API key isn’t valid, either you didn’t send one or it wasn’t valid.

Response Code: 422

  • Key Fields are missing from at least one object: Type, EventID, Data, Data.Name, Data.ObjectId, Data.ExternalOrgId, Data.Owner

If a key field is missing in the request:

{
    "message": "Validation Failed",
    "errors": [
        {
            "Field": "Type",
            "Code": "missing_field",
            "Message": "Missing required property: Type",
            "Resource": "Record"
        }
    ],
    "correlationId": "0owwmc6uchfej6u3"
}

If the Data object is missing in the request:

{
    "message": "Validation Failed",
    "errors": [
        {
            "Field": "Data",
            "Code": "missing_field",
            "Message": "Missing required property: Data",
            "Resource": "Record"
        }
    ],
    "correlationId": "0owwq8nzgqy2q4wc"
}

Response Code: 500

  • An error occurred with the endpoint. Try again later. If this continues to occur please contact Spinify.
How To Delete An Object

To delete an object, send an event with the same ObjectId as the object you would like to delete and "IsDeleted": true:

[{
  "Type":"Lead",
  "RecordUrl":"http://example.com/recordid",
"ExternalOrgId":"local",
"EventID":"uniquerandomvalue",
  "Data": {
  "ObjectId": "objectId", // the object id of the event that you would like to delete
"IsDeleted": true
  }
}]