Accounts

Get all accounts

GET /accounts

Query string parameters

Response
Status code 200

{
  "data": [
    {
      "id": "110ec600-d290-1bd0-af73-613b2b6ae476",
      "b2c": false,
      "user": {
        "id": 6,
        "name": "John Doe"
      },
      "fixed_fields": [
        {
          "type": "text",
          "name": "name",
          "label": "Name",
          "value": "Enim Nec Tempus LLP",
          "validation": null
        },
        {
          "type": "text",
          "name": "address",
          "label": "Address",
          "value": "03127 Sporer Field\nEast Rodrick, MD 78588-4990",
          "validation": null
        },
        {
          "type": "text",
          "name": "zip_code",
          "label": "Zip code",
          "value": 1751,
          "validation": null
        },
        {
          "type": "text",
          "name": "city",
          "label": "City",
          "value": "Kerlukeview",
          "validation": null
        },
        {
          "type": "text",
          "name": "state_region",
          "label": "State/Region",
          "value": "Wisconsin",
          "validation": null
        },
        {
          "type": "single_choice",
          "name": "country",
          "label": "Country",
          "value": {
            "id": 204,
            "value": "LK"
          },
          "validation": null
        },
        {
          "type": "text",
          "name": "vat",
          "label": "VAT",
          "value": 18616401104,
          "validation": null
        },
        {
          "type": "text",
          "name": "website",
          "label": "Website",
          "value": "http://www.Braun.com/ipsam-aut-vitae-qui-est-inventore",
          "validation": "url"
        }
      ],
      "custom_fields": null,
      "created_at": "2015-01-21 06:26:49",
      "updated_at": "2015-01-21 06:26:49"
    }
  ],
  "pagination": {
    "total": 51,
    "page": 1,
    "per_page": 15,
    "urls": {
      "previous": null,
      "next": "http://api.easir.com/accounts/?page=2"
    }
  }
}

Get a account

GET /accounts/:account_id

Response
Status code 200

{
  "id": "110ec600-d290-1bd0-af73-613b2b6ae476",
  "b2c": false,
  "user": {
    "id": 6,
    "name": "John Doe"
  },
  "fixed_fields": [
    {
      "type": "text",
      "name": "name",
      "label": "Name",
      "value": "Enim Nec Tempus LLP",
      "validation": null
    },
    {
      "type": "text",
      "name": "address",
      "label": "Address",
      "value": "03127 Sporer Field\nEast Rodrick, MD 78588-4990",
      "validation": null
    },
    {
      "type": "text",
      "name": "zip_code",
      "label": "Zip code",
      "value": 1751,
      "validation": null
    },
    {
      "type": "text",
      "name": "city",
      "label": "City",
      "value": "Kerlukeview",
      "validation": null
    },
    {
      "type": "text",
      "name": "state_region",
      "label": "State/Region",
      "value": "Wisconsin",
      "validation": null
    },
    {
      "type": "single_choice",
      "name": "country",
      "label": "Country",
      "value": {
        "id": 204,
        "value": "LK"
      },
      "validation": null,
      "options": [
        {
          "id": 1,
          "value": "AF"
        }
      ]
    },
    {
      "type": "text",
      "name": "vat",
      "label": "VAT",
      "value": 18616401104,
      "validation": null
    },
    {
      "type": "text",
      "name": "website",
      "label": "Website",
      "value": "http://www.Braun.com/ipsam-aut-vitae-qui-est-inventore",
      "validation": "url"
    }
  ],
  "custom_fields": [
    {
      "type": "text",
      "name": "email",
      "label": "Custom E-mail",
      "value": "Marielle99@hotmail.com",
      "validation": "email"
    },
    {
      "type": "numeric",
      "name": "number",
      "label": "Custom Number",
      "value": 14830,
      "validation": "numeric"
    },
    {
      "type": "date",
      "name": "date",
      "label": "Custom Date",
      "value": "2006-11-25T03:30:08+0000",
      "validation": "date"
    },
    {
      "type": "boolean",
      "name": "boolean",
      "label": "Custom Boolean",
      "value": false,
      "validation": "boolean"
    },
    {
      "type": "single_choice",
      "name": "single_choice",
      "label": "Custom Single Choice",
      "value": {
        "id": 487,
        "value": "Option 1"
      },
      "validation": null,
      "options": [
        {
          "id": 487,
          "value": "Option 1"
        },
        {
          "id": 488,
          "value": "Option 2"
        },
        {
          "id": 489,
          "value": "Option 3"
        }
      ]
    },
    {
      "type": "multiple_choice",
      "name": "multiple_choice",
      "label": "Custom Multiple Choice",
      "value": [
        {
          "id": 490,
          "value": "Option 1"
        },
        {
          "id": 491,
          "value": "Option 2"
        }
      ],
      "validation": null,
      "options": [
        {
          "id": 490,
          "value": "Option 1"
        },
        {
          "id": 491,
          "value": "Option 2"
        },
        {
          "id": 492,
          "value": "Option 3"
        },
        {
          "id": 493,
          "value": "Option 4"
        },
        {
          "id": 494,
          "value": "Option 5"
        }
      ]
    }
  ],
  "created_at": "2015-01-21 06:26:49",
  "updated_at": "2015-01-21 06:26:49"
}

Create account

POST /accounts

Parameters

  • user_id integer
  • team_id integer
    • Required without user_id
  • Supports Fields
    • Required
    • Matching resource Account

Payload

{
  "user_id" : 1,
  "team_id" : 419,
  "fixed_fields": [
    {
      "id": 1,
      "value": "Some account name"
    },
    {
      "name": "website",
      "value": "http://example.com"
    }
  ],
  "custom_fields": [
    {
      "name": "custom_e_mail",
      "value": "hi@example.com"
    }
  ]
}

Response
Status code 201

{
  "id": "f460fbda-ff3f-4438-9dfd-fb3e022a0b8a",
  "b2c": false,
  "user": {
    "id": 1,
    "name": "EASI’R Tester"
  },
  "fixed_fields": [
    {
      "type": "text",
      "name": "name",
      "label": "Name",
      "value": "Some account name",
      "validation": null
    },
    {
      "type": "text",
      "name": "website",
      "label": "Website",
      "value": "http://example.com",
      "validation": "url"
    }
  ],
  "custom_fields": [
    {
      "type": "text",
      "name": "custom_e_mail",
      "label": "Custom E-mail",
      "value": "hi@example.com",
      "validation": "email"
    }
  ],
  "created_at": "2015-01-21 07:44:38",
  "updated_at": "2015-01-21 07:44:38"
}

Update a account

PUT /accounts/:account_id

Parameters

  • user_id integer
  • team_id integer
    • Required without user_id
  • Supports Fields
    • Required
    • Matching resource Account

Payload

{
  "user_id" : 1,
  "team_id" : 419,
  "fixed_fields": [
    {
      "id": 1,
      "value": "Some updated account name"
    },
    {
      "name": "website",
      "value": "http://example.com/updated"
    }
  ],
  "custom_fields": [
    {
      "name": "custom_e_mail",
      "value": "hi_updated@example.com"
    }
  ]
}

Response
Status code 200

{
  "id": "f460fbda-ff3f-4438-9dfd-fb3e022a0b8a",
  "b2c": false,
  "user": {
    "id": 1,
    "name": "EASI’R Tester"
  },
  "fixed_fields": [
    {
      "type": "text",
      "name": "name",
      "label": "Name",
      "value": "Some updated account name",
      "validation": null
    },
    {
      "type": "text",
      "name": "website",
      "label": "Website",
      "value": "http://example.com",
      "validation": "url"
    }
  ],
  "custom_fields": [
    {
      "type": "text",
      "name": "custom_e_mail",
      "label": "Custom E-mail",
      "value": "hi@example.com",
      "validation": "email"
    }
  ],
  "created_at": "2015-01-21 07:44:38",
  "updated_at": "2015-01-21 07:45:38"
}

Delete a account

DELETE /accounts/:account_id

Response
Status code 204

Checking delete impact

GET /accounts/:account_id/delete-impact

Can be used to get a status of what will happen when you delete an account.
If blocked_by has any values, you can't delete the account without first solving the impediments listed.

Response
Status code 200

{
  "blocked_by": [
    {
      "type": "company_settings",
      "amount": 1,
      "attribute": "default_account_id"
    }
  ],
  "deletes": [
    {
      "type": "activity",
      "amount": 10
    },
    {
      "type": "additional_data",
      "amount": 4
    },
    {
      "type": "additional_data_connection",
      "amount": 6
    },
    {
      "type": "case",
      "amount": 6
    },
    {
      "type": "contact",
      "amount": 3
    },
    {
      "type": "lead",
      "amount": 3
    },
    {
      "type": "task",
      "amount": 10
    }
  ]
}

Cases for a account

GET /accounts/:account_id/cases

Query string parameters

  • status string - Case status.
    • open
    • closed
    • declined
    • default: null
  • Supports Searching
  • Supports Pagination

Response
Status code 200

{
  "data": [
    {
      "id": "23a55e3b-ad9d-3649-bd3e-ce7f2ee208c2",
      "case_number": 9,
      "status": "declined",
      "account": {
        "id": "76f3b0b7-5026-36d9-bdd3-622e27a2a917",
        "name": "Sandberg A/S"
      },
      "contact": {
        "id": "d6c702ef-1806-36c7-81bc-1a4f9555ed8b",
        "name": "Alice Brandt"
      },
      "user": {
        "id": 16,
        "name": "Idell Buckridge"
      },
      "relations_path": {
        "id": "9eae431b-3d0f-4528-9c59-e9d1a40fcd04",
        "name": "UPDATED!"
      },
      "chance_of_success": 95,
      "milestones": [
        {
          "id": "a203539b-f06c-442c-8ad0-f5a56f0615f6",
          "name": "Contract",
          "done": true
        },
        {
          "id": "943cef92-f9b4-4fcb-b4e4-834f34915973",
          "name": "Milestone 2",
          "done": true
        }
      ],
      "latest_activity_at": "2015-02-24 12:34:56",
      "estimated_close_date": "2015-02-24",
      "created_at": "2015-02-24 12:34:56",
      "updated_at": "2015-02-24 12:34:56"
    }
  ],
  "pagination": {
    "total": 2,
    "page": 1,
    "per_page": 15,
    "urls": {
      "previous": null,
      "next": null
    }
  },
  "statuses": {
    "all": 2,
    "open": 1,
    "closed": 0,
    "declined": 1
  }
}