Roles API

Roles API is used to manage roles under and Agenty account. Use this API to create new roles programmatically, give access or revoke access etc.

Create a new role

Endpoint:

Method: POST
URL: https://api.agenty.com/v1/roles

Headers:

Key Value Description
Content-Type application/json

Query params:

Key Value Description
apikey {{API_KEY}}

Body:

{
    "name": "Agents developer",
    "roles": ViewAgent,CreateAgent,UpdateAgent,CloneAgent,DeleteAgent,StartAgent,StopAgent,ScheduleAgent,ViewLogs,ViewResult"
}

Responses:

Status: OK | Code: 200

{
    "status_code": 200,
    "message": "A new role with id: 9 created successfully"
}

Get role by id

Endpoint:

Method: GET
URL: https://api.agenty.com/v1/roles/{{ROLE_ID}}

Query params:

Key Value Description
apikey {{API_KEY}}

Responses:

Status: OK | Code: 200

{
    "role_id": 4,
    "name": "Manager",
    "roles": "UpdateAccount,ViewAgent,CreateAgent,UpdateAgent,CloneAgent,DeleteAgent,StartAgent,StopAgent,ScheduleAgent,ViewLogs,ViewResult,ViewBucket,UpdateBucket,CreateBucket,DeleteBucket,ViewList,CreateList,UpdateList,DeleteList,ViewPlugin,UpdatePlugin,CreatePlugin,DeletePlugin,ViewScript,UpdateScript,CreateScript,DeleteScript",
    "created_at": "2018-09-14T11:22:08",
    "updated_at": "2019-02-28T05:52:45",
    "is_public": true
}

Update role by id

Endpoint:

Method: PUT
URL: https://api.agenty.com/v1/roles/{{ROLE_ID}}

Headers:

Key Value Description
Content-Type application/json

Query params:

Key Value Description
apikey {{API_KEY}}

Body:

{
    "role_id": 9,
    "name": "Agents tester",
    "roles": "ViewAgent,ViewLogs,ViewResult"
}

Responses:

Status: OK | Code: 200

{
    "status_code": 200,
    "message": "Role with id: 9 updated successfully"
}

Get all roles

Endpoint:

Method: GET
URL: https://api.agenty.com/v1/roles

Query params:

Key Value Description
apikey {{API_KEY}}

Responses:

Status: OK | Code: 200

{
    "total": 5,
    "limit": 1000,
    "offset": 0,
    "returned": 5,
    "result": [
        {
            "role_id": 5,
            "name": "Viewer",
            "roles": "ViewAgent,ViewLogs,ViewResult,ViewBucket,ViewList,ViewPlugin,ViewScript",
            "created_at": "2018-09-14T11:23:24",
            "updated_at": "2019-02-28T05:52:45",
            "is_public": true
        },
        {
            "role_id": 6,
            "name": "Accountant",
            "roles": "ViewInvoice",
            "created_at": "2019-02-28T05:57:45",
            "updated_at": "2019-03-01T05:16:12",
            "is_public": true
        }
        ......
    ]
}

Delete role by id

Endpoint:

Method: DELETE
URL: https://api.agenty.com/v1/roles/{{ROLE_ID}}

Query params:

Key Value Description
apikey {{API_KEY}}

Responses:

Status: OK | Code: 200

{
    "status_code": 200,
    "message": "Role with id: 9 deleted successfully"
}