fbpx

Roles

This s a documentation page for our shiny new REST API - you weren't meant to find it. This API isn't ready for public use yet. We're chopping and changing it a LOT as we grow it. So if you build something that uses it then it's very likely to break in a future update. Don't say you weren't warned!

URL:

https://api.kashflow.com/v2/roles

Method(s):

get, post, put, delete

Response Formats:

JSON, XML

Description:

This method allows you to retrieve, create, update and delete roles. The individual resource is identified by the role number. So /roles/123 would return the role with number 123. Similarly a PUT to that URL would update role 123.

Parameters

NameTypeDescription
NumberNumericCompany specific number assigned to role
NameStringName of role
PermissionsCollectionList of permissions that belong to the role
DescriptionStringDescription of the role
UserNamesCollectionList of user names that belong to the role
UserCountNumericNumber of user names that belong to this role
IsAdminBooleanFlag indicating whether the user is admin or not. True indicates user is admin.

GET Operation

To get list of roles –

URL : /roles

Example response for GET of role list


[{
    "Description": "role with full access on all features",
    "IsAdmin": false,
    "UserCount": 0,
    "Permissions": [],
    "Number": 12,
    "Name": "Full Access",
    "UserNames": []
}, {
    "Description": "role with full access on projects",
    "IsAdmin": false,
    "UserCount": 0,
    "Permissions": ["ViewProject","CreateProject","UpdateProject","DeleteProject"],
    "Number": 13,
    "Name": "Projects only (full access)",
    "UserNames": []
}, {
    "Description": "role with full access on quotes",
    "IsAdmin": false,
    "UserCount": 0,
    "Permissions": ["ViewQuote","CreateQuote","UpdateQuote","DeleteQuote"],
    "Number": 14,
    "Name": "Quotes only (full access)",
    "UserNames": []
}, {
    "Description": "role with readonly access on projects and quotes",
    "IsAdmin": false,
    "UserCount": 0,
    "Permissions": ["ViewQuote","ViewProject"],
    "Number": 15,
    "Name": "Projects & Quotes (read only)",
    "UserNames": []
}, {
    "Description": "role with read and create permissions on quotes an",
    "IsAdmin": false,
    "UserCount": 0,
    "Permissions": [],
    "Number": 16,
    "Name": "Projects & Quotes (read/create only) ",
    "UserNames": []
}]

To get details of a particular role –

URL : /roles/{number}

Example response for GET of role


{
    "Description": "role with readonly access on projects and quotes",
    "IsAdmin": false,
    "UserCount": 0,
    "Permissions": ["ViewQuote","ViewProject"],
    "Number": 15,
    "Name": "Projects & Quotes (read only)",
    "UserNames": []
}

POST Operation

To create role with the given role data –

URL : /roles

Example request for POST of role


{
    "Description": "role with readonly access on projects and quotes",
    "Permissions": ["ViewQuote","ViewProject"],
    "Name": "Projects & Quotes (read only)"
}

PUT Operation

To update role details for the specified role –

URL : /roles/{number}
{number} in the URL should be replaced with the number of the role to be updated.

Example request for PUT of role


{
    "Description": "role with readonly access on projects and quotes",
    "Permissions": ["ViewQuote","ViewProject"],
    "Number": 15,
    "Name": "Projects & Quotes (read only)"
}

DELETE Operation

Deletes the role with the number provided in the URL –

URL : /roles/{number}

See how KashFlow works with your business and your books