Roles

The Role object

A Role object has the following properties:

  • id : string - The unique identifier of a role
  • name : string - The name of a role

Add a data source to a role

Adds a data source to a role.

PUT /api/v2/role/:role/data-source/:data-source

Arguments:

  • role - The identifier of a role
  • data-source - The identifier of a data source to add to the role

Response object:

This method returns an object with no properties.

Example request:

$ curl \
    -H "Accept: application/vnd.jackdb.v2+json" \
    -u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
    -X PUT \
    "${JACKDB_API_URL}/role/RKm2x3dfX0b505iHy/data-source/DvZqlrLUHTE4G11L9"

Example response:

{}

Note: This is an idempotent endpoint. Adding a data source to a role that already contains the data source will return a success response.

Assign a person to a role

Assign a person to a role.

PUT /api/v2/role/:role/person/:person

Arguments:

  • role - The identifier of a role
  • person - The identifier of a person to assign to the role

Response object:

This method returns an object with no properties.

Example request:

$ curl \
    -H "Accept: application/vnd.jackdb.v2+json" \
    -u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
    -X PUT \
    "${JACKDB_API_URL}/role/RKm2x3dfX0b505iHy/person/P9mbZ6vLpPJETzAW2"

Example response:

{}

Note: This is an idempotent endpoint.

Create a role

Creates a new role.

POST /api/v2/role

Arguments:

  • name : string : The name of the new role

Response object:

  • A newly-created Role object with the following properties:
    • id - string : The unique identifier of the role
    • name - string : The name of the role
    • createdAt - timestamp : When the role was created
    • updatedAt - timestamp : When the role was last updated

Example request:

$ curl \
    -H "Accept: application/vnd.jackdb.v2+json" \
    -u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
    -X POST \
    "${JACKDB_API_URL}/role" \
    -d "name=SomeRole"

Example response:

{
  "updatedAt": "2015-03-12T15:07:00.966Z",
  "createdAt": "2015-03-12T15:07:00.966Z",
  "name": "SomeRole",
  "id": "Rhq4aWOpNa6grdh6"
}

Delete a role

Permanently deletes an existing role.

DELETE /api/v2/role/:role

Arguments:

  • role - The identifier of the role to be deleted

Response object:

This method returns an object with no properties.

Example request:

$ curl \
    -H "Accept: application/vnd.jackdb.v2+json" \
    -u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
    -X DELETE \
    "${JACKDB_API_URL}/role/Rhq4aWOpNa6grdh6"

Example response:

{}

List all data sources in a role

Returns a list of all data sources in a role.

GET /api/v2/role/:role/data-source

Arguments:

  • role - The identifier of a role

Response object:

  • An array of Data Source objects
  • Each entry in the array is an object with the following properties:
    • id - string : The unique identifier of the data source
    • name - string : The name of the data source
    • alias - string : The unique alias of the data source
    • assignedAt - timestamp : When the data source was added to the role

Example request:

$ curl \
    -H "Accept: application/vnd.jackdb.v2+json" \
    -u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
    "${JACKDB_API_URL}/role/RKm2x3dfX0b505iHy/data-source"

Example response:

[
  {
    "id": "DvZqlrLUHTE4G11L9",
    "name": "GL Production",
    "alias": "gl-prod",
    "assignedAt": "2015-03-05T17:02:35.314Z"
  },
  {
    "id": "DFtlu8gfkiOSl0zf",
    "name": "GL Testing",
    "alias": "gl-uat",
    "assignedAt": "2015-02-15T20:07:12.501Z"
  }
]

List all people assigned to a role

Returns a list of all people assigned to a role.

GET /api/v2/role/:role/person

Arguments:

  • role - The identifier of a role

Response object:

  • An array of Person objects
  • Each entry in the array is an object with the following properties:
    • id - string : The unique identifier of the person
    • username - string : The username of the person
    • email - string : The email address of the person
    • name - string : The name of the person
    • assignedAt - timestamp : When the person was assigned to the role

Example request:

$ curl \
    -H "Accept: application/vnd.jackdb.v2+json" \
    -u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
    "${JACKDB_API_URL}/role/RKm2x3dfX0b505iHy/person"

Example response:

[
  {
    "id": "P0cKFCMIHoNaBFt7Y",
    "username": "ghiggins",
    "email": "griffin.higgins@example.com",
    "name": "Griffin Higgins",
    "assignedAt": "2014-07-28T01:21:56.147Z"        
  },
  {
    "id": "P3Fz69ORRudnQo5LE",
    "username": "astark",
    "email": "ameer.stark@example.com",
    "name": "Ameer Stark",
    "assignedAt": "2014-07-31T01:25:19.874Z"
  },
  {
    "id": "P9mbZ6vLpPJETzAW2",
    "username": "abuckner",
    "email": "alexia.buckner@example.com",
    "name": "Alexia Buckner",
    "assignedAt": "2014-07-29T13:35:40.433Z"
  }
]

List all roles

Returns a list of all roles.

GET /api/v2/role

Arguments:

This method has no additional arguments.

Response object:

  • An array of Role objects
  • Each entry in the array is an object with the following properties:
    • id - string : The unique identifier of the role
    • name - string : The name of the role
    • createdAt - timestamp : When the role was created
    • updatedAt - timestamp : When the role was last updated

Example request:

$ curl \
    -H "Accept: application/vnd.jackdb.v2+json" \
    -u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
    "${JACKDB_API_URL}/role"

Example response:

[
  {
    "updatedAt": "2014-07-31T18:09:58.637Z",
    "createdAt": "2014-07-27T15:01:59.901Z",
    "name": "HR",
    "id": "RKm2x3dfX0b505iHy"
  },
  {
    "updatedAt": "2014-07-31T18:09:58.637Z",
    "createdAt": "2014-07-20T17:02:16.387Z",
    "name": "Finance",
    "id": "RC98On0Dus9ZrskYH"
  },
  {
    "updatedAt": "2014-07-31T18:09:58.637Z",
    "createdAt": "2014-07-12T12:04:28.334Z",
    "name": "CRM",
    "id": "RjNMsZ80ELfcxDSv1"
  }
]

Remove a data source from a role

Permanently removes a data source from a role.

DELETE /api/v2/role/:role/data-source/:data-source

Arguments:

  • role - The identifier of a role
  • data-source - The identifier of a data source to remove from the role

Response object:

This method returns an object with no properties.

Example request:

$ curl \
    -H "Accept: application/vnd.jackdb.v2+json" \
    -u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
    -X DELETE \
    "${JACKDB_API_URL}/role/RKm2x3dfX0b505iHy/data-source/DvZqlrLUHTE4G11L9"

Example response:

{}

Remove a person from a role

Permanently removes a person from a role.

DELETE /api/v2/role/:role/person/:person

Arguments:

  • role - The identifier of a role
  • person - The identifier of a person to remove from the role

Response object:

This method returns an object with no properties.

Example request:

$ curl \
    -H "Accept: application/vnd.jackdb.v2+json" \
    -u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
    -X DELETE \
    "${JACKDB_API_URL}/role/RKm2x3dfX0b505iHy/person/P9mbZ6vLpPJETzAW2"

Example response:

{}

Retrieve a role

Retrieves the details of an existing role.

GET /api/v2/role/:role

Arguments:

  • role - The identifier of the role to be retrieved

Response object:

  • A Role object with the following properties:
    • id - string : The unique identifier of the role
    • name - string : The name of the role
    • createdAt - timestamp : When the role was created
    • updatedAt - timestamp : When the role was last updated

Example request:

$ curl \
    -H "Accept: application/vnd.jackdb.v2+json" \
    -u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
    "${JACKDB_API_URL}/role/RKm2x3dfX0b505iHy"

Example response:

{
  "id": "RKm2x3dfX0b505iHy",
  "name": "HR",
  "createdAt": "2014-07-27T15:01:59.901Z",
  "updatedAt": "2014-07-31T18:09:58.637Z"
}