Additional Data

You can assign additional data to a account, and one, or more contacts. The additional-data is a collection of custom fields, and can be whatever you want it to be.

You start be defining your connection types. If the additional data is a fruit, the connection types can be owner, plucker and eater. Then you create your "fruit" and assign it to an account. When created you can connect contacts to it.

Connection types

A connection type is just a name and a id for the link between contacts and the actual additional data.

Get connection types

GET /additional-data/connections

Query string parameters

Response
Status code 200

{
  "data": [
    {
      "id": 1,
      "name": "Name",
      "created_at": "2015-05-05 07:36:46",
      "updated_at": "2015-05-05 07:36:46"
    }
  ],
  "pagination": {
    "total": 1,
    "page": 1,
    "per_page": 15,
    "urls": {
      "previous": null,
      "next": null
    }
  }
}

Get a connection type

GET /additional-data/connections/:connection_id

Response
Status code 200

{
  "id": 1,
  "name": "Name",
  "created_at": "2015-05-05 07:36:46",
  "updated_at": "2015-05-05 07:36:46"
}

Create a connection type

POST /additional-data/connections

Parameters

  • name string - The connection type name.
    • Must be unique.
    • Required
{
  "name": "Some name"
}

Response
Status code 201

{
  "id": 2,
  "name": "Some name",
  "created_at": "2015-05-05 08:05:15",
  "updated_at": "2015-05-05 08:05:15"
}

Update a connection type

PUT /additional-data/connections/:connection_id

Parameters

  • name string - The connection type name.
    • Must be unique.
    • Required
{
  "name": "Some updated name"
}

Response
Status code 200

{
  "id": 1,
  "name": "Some updated name",
  "created_at": "2015-05-05 07:36:46",
  "updated_at": "2015-05-05 08:12:03"
}

Delete a connection type

DELETE /additional-data/connections/:connection_id

Response
Status code 204

The data

The actual data is just custom fields. Create your custom fields before you create additional data!

Get all additional data for an account

GET /accounts/:account_id/additional-data

Query string parameters

Response
Status code 200

{
  "data": [
    {
      "id": "69bf1263-f438-40c1-ba9d-d350669ab13c",
      "custom_fields": [
        {
          "type": "text",
          "name": "name",
          "label": "name",
          "value": "Something something",
          "validation": null,
          "required": false
        }
      ],
      "created_at": "2015-05-01 12:00:12",
      "updated_at": "2015-05-01 12:00:12",
      "deprecated_at": "2015-05-01 12:00:12"
    }
  ],
  "pagination": {
    "total": 20,
    "page": 1,
    "per_page": 15,
    "urls": {
      "previous": null,
      "next": "http://api.easir.com/accounts/ee0d6beb-ca91-4d6d-84a7-f325288a6e96/additional-data/?page=2"
    }
  }
}

Get specific additional data

GET /accounts/:account_id/additional-data/:additional_data_id

Response
Status code 200

{
  "id": "69bf1263-f438-40c1-ba9d-d350669ab13c",
  "custom_fields": [
    {
      "type": "text",
      "name": "name",
      "label": "name",
      "value": "Something something",
      "validation": null,
      "required": false
    }
  ],
  "connections": [
    {
      "id": "aa057f9d-d970-450a-b8c1-007cb3e5ef5a",
      "type": {
        "id": 1,
        "name": "Some updated name",
        "created_at": "2015-05-05 07:36:46",
        "updated_at": "2015-05-05 08:12:03"
      },
      "contact": {
        "id": "8dbb05f9-e19c-34f8-8885-eed4e520bf3c",
        "b2c": true,
        "account": {
          "id": "3cb87c2f-0feb-3b10-90a1-b5d01bb3eb69",
          "name": "Account name"
        },
        "user": null,
        "status": "opportunity",
        "fixed_fields": [
          {
            "type": "text",
            "name": "salutation",
            "label": "Salutation",
            "value": "Prof.",
            "validation": null,
            "required": false
          }
        ],
        "custom_fields": [],
        "created_at": "2015-02-24 12:34:56",
        "updated_at": "2015-02-24 12:34:56"
      },
      "created_at": "2015-05-01 12:00:12",
      "updated_at": "2015-05-01 12:00:12"
    }
  ],
  "created_at": "2015-05-01 12:00:12",
  "updated_at": "2015-05-01 12:00:12",
  "deprecated_at": "2015-05-01 12:00:12"
}

Get all additional data for a contact

GET /accounts/:account_id/contacts/:contact_id/additional-data

Query string parameters

Response
Status code 200

{
  "data": [
    {
      "id": "69bf1263-f438-40c1-ba9d-d350669ab13c",
      "custom_fields": [
        {
          "type": "text",
          "name": "name",
          "label": "name",
          "value": "Some name",
          "validation": null,
          "required": false
        }
      ],
      "connections": [
        {
          "id": "aa057f9d-d970-450a-b8c1-007cb3e5ef5a",
          "type": {
            "id": 1,
            "name": "Some updated name",
            "created_at": "2015-05-05 07:36:46",
            "updated_at": "2015-05-05 08:12:03"
          },
          "contact": {
            "id": "8dbb05f9-e19c-34f8-8885-eed4e520bf3c",
            "b2c": true,
            "account": {
              "id": "3cb87c2f-0feb-3b10-90a1-b5d01bb3eb69",
              "name": "Account name"
            },
            "user": null,
            "status": "opportunity",
            "fixed_fields": [
              {
                "type": "text",
                "name": "salutation",
                "label": "Salutation",
                "value": "Prof.",
                "validation": null,
                "required": false
              }
            ],
            "custom_fields": [],
            "created_at": "2015-02-24 12:34:56",
            "updated_at": "2015-02-24 12:34:56"
          },
          "created_at": "2015-05-01 12:00:12",
          "updated_at": "2015-05-01 12:00:12"
        }
      ],
      "created_at": "2015-05-01 12:00:12",
      "updated_at": "2015-05-01 12:00:12",
      "deprecated_at": "2015-05-01 12:00:12"
    }
  ],
  "pagination": {
    "total": 1,
    "page": 1,
    "per_page": 15,
    "urls": {
      "previous": null,
      "next": null
    }
  }
}

Create additional data

POST /accounts/:account_id/additional-data

Parameters

  • Supports Fields
    • Does not support fixed_fields
  • Supports Backdating
  • deprecated boolean - Marks the data as deprecated

Payload

{
  "custom_fields": [
    {
      "name": "name",
      "value": "Some name"
    }
  ],
  "deprecated": true
}

Response
Status code 201

{
  "id": "dedb6474-087c-417e-93e3-aba65d747f90",
  "custom_fields": [
    {
      "type": "text",
      "name": "name",
      "label": "name",
      "value": "Some name",
      "validation": null,
      "required": false
    }
  ],
  "created_at": "2015-05-05 08:43:54",
  "updated_at": "2015-05-05 08:43:54",
  "deprecated_at": "2015-05-01 12:00:12"
}

Update additional data

PUT /accounts/:account_id/additional-data/:additional_data_id

Parameters

  • Supports Fields
    • Does not support fixed_fields
  • deprecated boolean - Marks the data as deprecated

Payload

{
  "custom_fields": [
    {
      "name": "name",
      "value": "Some updated name"
    }
  ]
}

Response
Status code 200

{
  "id": "dedb6474-087c-417e-93e3-aba65d747f90",
  "custom_fields": [
    {
      "type": "text",
      "name": "name",
      "label": "name",
      "value": "Some updated name",
      "validation": null,
      "required": false
    }
  ],
  "created_at": "2015-05-05 08:43:54",
  "updated_at": "2015-05-05 08:45:25",
  "deprecated_at": "2015-05-01 12:00:12"
}

Delete additional data

DELETE /accounts/:account_id/additional-data/:additional_data_id

Response
Status code 204

Connections

When you want to connect a contact and some additional data you have to use your connection type.
A contact can only be connected to the same additional data with the same connection type once

Connect a contact

POST /accounts/:account_id/additional-data/:additional_data_id/connections

Parameters

  • connection_id integer - Id of the connection you want to use.
    • Required
  • contact_id UUID - Id of the contact you want to connect.
    • Required

Payload

{
  "connection_id": 1,
  "contact_id": "8dbb05f9-e19c-34f8-8885-eed4e520bf3c"
}

Response
Status code 201

{
  "id": "5b0fa7cb-8ae2-41b0-8128-856b7e7063af",
  "type": {
    "id": 1,
    "name": "Some updated name",
    "created_at": "2015-05-05 07:36:46",
    "updated_at": "2015-05-05 08:12:03"
  },
  "contact": {
    "id": "8dbb05f9-e19c-34f8-8885-eed4e520bf3c",
    "b2c": true,
    "account": {
      "id": "3cb87c2f-0feb-3b10-90a1-b5d01bb3eb69",
      "name": "Account name"
    },
    "user": null,
    "status": "opportunity",
    "fixed_fields": [
      {
        "type": "text",
        "name": "salutation",
        "label": "Salutation",
        "value": "Prof.",
        "validation": null,
        "required": false
      }
    ],
    "custom_fields": [],
    "created_at": "2015-02-24 12:34:56",
    "updated_at": "2015-02-24 12:34:56"
  },
  "created_at": "2015-05-05 11:05:18",
  "updated_at": "2015-05-05 11:05:18"
}

Update a connection

PUT /accounts/:account_id/additional-data/:additional_data_id/connections/:connection_id

Parameters

  • connection_id integer - Id of the connection you want to use.
    • Required
  • contact_id UUID - Id of the contact you want to connect.
    • Required

Payload

{
  "connection_id": 3,
  "contact_id": "8dbb05f9-e19c-34f8-8885-eed4e520bf3c"
}

Response
Status code 200

{
  "id": "5b0fa7cb-8ae2-41b0-8128-856b7e7063af",
  "type": {
    "id": 3,
    "name": "Something other",
    "created_at": "2015-05-05 07:36:46",
    "updated_at": "2015-05-05 08:12:03"
  },
  "contact": {
    "id": "8dbb05f9-e19c-34f8-8885-eed4e520bf3c",
    "b2c": true,
    "account": {
      "id": "3cb87c2f-0feb-3b10-90a1-b5d01bb3eb69",
      "name": "Account name"
    },
    "user": null,
    "status": "opportunity",
    "fixed_fields": [
      {
        "type": "text",
        "name": "salutation",
        "label": "Salutation",
        "value": "Prof.",
        "validation": null,
        "required": false
      }
    ],
    "custom_fields": [],
    "created_at": "2015-02-24 12:34:56",
    "updated_at": "2015-02-24 12:34:56"
  },
  "created_at": "2015-05-05 11:05:18",
  "updated_at": "2015-05-05 11:05:18"
}

Get a connection

GET /accounts/:account_id/additional-data/:additional_data_id/connections/:connection_id

Response
Status code 200

{
  "id": "5b0fa7cb-8ae2-41b0-8128-856b7e7063af",
  "type": {
    "id": 3,
    "name": "Something other",
    "created_at": "2015-05-05 07:36:46",
    "updated_at": "2015-05-05 08:12:03"
  },
  "contact": {
    "id": "8dbb05f9-e19c-34f8-8885-eed4e520bf3c",
    "b2c": true,
    "account": {
      "id": "3cb87c2f-0feb-3b10-90a1-b5d01bb3eb69",
      "name": "Account name"
    },
    "user": null,
    "status": "opportunity",
    "fixed_fields": [
      {
        "type": "text",
        "name": "salutation",
        "label": "Salutation",
        "value": "Prof.",
        "validation": null,
        "required": false
      }
    ],
    "custom_fields": [],
    "created_at": "2015-02-24 12:34:56",
    "updated_at": "2015-02-24 12:34:56"
  },
  "created_at": "2015-05-05 11:05:18",
  "updated_at": "2015-05-05 11:05:18"
}

Disconnect a contact

DELETE /accounts/:account_id/additional-data/:additional_data_id/connections/:connection_id

Response
Status code 204

Get table fields

GET /additional-data/table-fields

Response
Status code 200

{
  "data": [
    {
      "id": 17,
      "name": "car_age",
      "label": "Car age",
      "type": "date",
      "required": false,
      "validation": "date",
      "hidden": false,
      "read_only": false,
      "sort_order": 2,
      "team_id": null,
      "group_id": null
    },
    {
      "id": 16,
      "name": "mileage",
      "label": "Mileage",
      "type": "numeric",
      "required": false,
      "validation": "numeric",
      "hidden": false,
      "read_only": false,
      "sort_order": 3,
      "team_id": null,
      "group_id": null
    },
    {
      "id": 15,
      "name": "name",
      "label": "name",
      "type": "text",
      "required": false,
      "validation": null,
      "hidden": false,
      "read_only": false,
      "sort_order": 4,
      "team_id": null,
      "group_id": null
    }
  ]
}

Set table fields

PUT /additional-data/table-fields

Parameters

  • custom_field_ids array - Custom field-ids.
    • owner_type must be equal to additional_data.
    • Required

Payload

{
  "custom_field_ids": [15, 16, 17]
}

Response
Status code 200

{
  "data": [
    {
      "id": 17,
      "name": "car_age",
      "label": "Car age",
      "type": "date",
      "required": false,
      "validation": "date",
      "hidden": false,
      "read_only": false,
      "sort_order": 2,
      "team_id": null,
      "group_id": null
    },
    {
      "id": 16,
      "name": "mileage",
      "label": "Mileage",
      "type": "numeric",
      "required": false,
      "validation": "numeric",
      "hidden": false,
      "read_only": false,
      "sort_order": 3,
      "team_id": null,
      "group_id": null
    },
    {
      "id": 15,
      "name": "name",
      "label": "name",
      "type": "text",
      "required": false,
      "validation": null,
      "hidden": false,
      "read_only": false,
      "sort_order": 4,
      "team_id": null,
      "group_id": null
    }
  ]
}