Organisations

Getting details

Retrieve all information about a given org.

Request URL:

GET /api/v2/org/{org_id}?api_key={my_api_key}

Query parameters:

Parameter Type Required Description
api_key string True Your API key
org_id int True Organisation id

JSON response:

{
    "org_id": 1234,
    "name": "Partoo",
    "alias": "partoo"
}

Searching

The org/search/ resource lets you search for orgs using filters.

Request URL:

GET /api/v2/org/search?api_key={my_api_key}

Request parameters:

Parameter Type Required Default Description
api_key string True None Your API key
org_id int False None Filter orgs by org id
name string False None Filter orgs by name
alias string False None Filter orgs by alias
page int False 1 Page number. 30 results per page.

JSON response:

{
    'page'            : page number (int),
    'max_page'        : last page number (int),
    'count'           : total number of businesses found (int),
    'orgs': [
        {
            'org_id'            : org id (int),
            'name'              : name (string),
            'alias'             : alias of the org (string)
        }
    ]
}

Creating

The org/ resource lets you create a new org.

Request URL:

POST /api/v2/org

Request JSON Body:

{
    "api_key": "you_api_key",
    "name": "Partoo",
    "alias": "partoo_org"
}

Request parameters:

Parameter Type Required Default Description
api_key string True   Your API key
name string True   Name of the org
alias string False auto generated Alias of the org (should match regex [a-z0-9_]+)

JSON response:

{
    "status": "success",
    "org_id": 12345,
    "alias": "partoo_org_2"
}

Updating

The org/ resource lets you update org.

Request URL:

POST /api/v2/org/{org_id}

Request JSON Body:

{
    "api_key": "you_api_key",
    "name": "Partoo",
    "alias": "partoo"
}

Request parameters:

Parameter Type Required Default Description
api_key string True   Your API key
org_id int True   Id of the organisation to update
name string True   Name of the org
alias string False   Alias of the org (should match regex [a-z0-9_]+)

JSON response:

{
    "status": "success",
    "org_id": 12345
}

Deleting

Delete a given org and all the resources linked to it (businesses and users). You must be an PROVIDER to perform this action. If your org still has businesses or users, it would raise an error if you do not indicate “force”: “True” in the JSON body.

Request URL:

DELETE /api/v2/org/{org_id}

Request JSON Body:

{
    "api_key": "you_api_key",
    "force": "False"
}

Request parameters:

Parameter Type Required Default Description
api_key string True   Your API key
force True|False False False Force the deletion of org even if there are still users and business linked to it

JSON response:

{
    "status": "success",
    "org_id": 12345
}