Organizations

Fetch all organizations


Return all the organizations
GET /organizations
page Page number of organizations to return. Returns empty array if the page has no organizations. If page parameter isn't present, returns the first page Optional
size Number of organizations to return in a page. If size parameter isn't present, returns the page with 25 organizations Optional
Response Body
[
    {
        "_id": "521f26eccce8b4310e000075",
        "name": "Foo Organization",
        "email": "[email protected]",
        "phone": "5553336666",
        "website": "http://www.foocorp.com",
        "address": null,
        "fields":  [
            {
              "_id": "531ed3a49a21f6e90b00000e",
              "name": "custom organization field",
              "value": "Monthly"
            }
        ],
        "contacts": [
            {
                "_id": "521f26eccce8b4310e000076",
                "name": "Foo Guy",
                "designation": null,
                "email": "[email protected]",
                "phone": "5553331234",
                "address": null,
                "fields":  [
                    {
                      "_id": "531ed3a49a21f6e90b00000e",
                      "name": "custom contact field",
                      "value": "Annual"
                    }
                ]
            }
        ]
    }
]

Show a organization


Show details of an individual organization
GET /organizations/:organization_id
organization_id Unique identifier of the organization Required
Response Body
{
    "_id": "521f26eccce8b4310e000075",
    "name": "Foo Organization",
    "email": "[email protected]",
    "phone": "5553336666",
    "website": "http://www.foocorp.com",
    "address": null,
    "fields":  [
        {
          "_id": "531ed3a49a21f6e90b00000e",
          "name": "custom organization field",
          "value": "Monthly"
        }
    ],
    "contacts": [
        {
            "_id": "521f26eccce8b4310e000076",
            "name": "Foo Guy",
            "designation": null,
            "email": "[email protected]",
            "phone": "5553331234",
            "address": null,
            "fields":  [
                {
                  "_id": "531ed3a49a21f6e90b00000e",
                  "name": "custom contact field",
                  "value": "Annual"
                }
            ]
        }
    ]
}

Create a organization


Create a new organization
POST /organizations
name Name of the organization Required
email Email of the organization. Optional
phone Phone of the organization. Optional
website Website of the organization. Optional
address Address of the organization. Optional
Response Body
{
    "_id": "521f26eccce8b4310e000075",
    "name": "Created Foo Organization",
    "email": "[email protected]",
    "phone": "5553336666",
    "website": "http://www.foocorp.com",
    "address": null,
    "fields":  [
        {
          "_id": "531ed3a49a21f6e90b00000e",
          "name": "custom organization field",
          "value": null
        }
    ]
}

Update a organization


Update the name of a organization
PUT /organizations/:organization_id
organization_id Unique identifier of the organization Required
name Name of the organization Optional
email Email of the organization. Optional
phone Phone of the organization. Optional
website Website of the organization. Optional
address Address of the organization. Optional
Response Body
{
    "_id": "521f26eccce8b4310e000075",
    "name": "Updated Foo Organization",
    "email": "[email protected]",
    "phone": "5553336666",
    "website": "http://www.foocorp.com",
    "address": null,
    "fields":  [
        {
          "_id": "531ed3a49a21f6e90b00000e",
          "name": "custom organization field",
          "value": null
        }
    ]
}

Update the value of a organization's custom fields
PUT /organizations/:organization_id/fields/:field_id
organization_id Unique identifier of the organization Required
field_id Unique identifier of the field Required
value Value of the field Optional
Response Body
{
    "_id": "521f26eccce8b4310e000075",
    "name": "Updated Foo Organization",
    "email": "[email protected]",
    "phone": "5553336666",
    "website": "http://www.foocorp.com",
    "address": null,
    "fields":  [
        {
          "_id": "531ed3a49a21f6e90b00000e",
          "name": "custom organization field",
          "value": "Monthly"
        }
    ]
}

Delete a organization


Delete a organization
DELETE /organizations/:organization_id
organization_id Unique identifier of the organization Required
Response Body
{}