PROJECTS

Use the Projects API to:

  • Get all projects
  • Create a project
  • Update a project
  • Delete a project

HTTP Headers

The HTTP headers used to access all RTLS APIs are listed below. Before submitting requests to the Projects API, set the following headers:

Header Name Example Value Description
X-User-Email admin@example.com Email of the user performing HTTP requests to the API.
X-User-Token Drv3yU7PdyqUMtr89erZ Token allowing the user access to the API.
X-User-Project OfOgUA4kTs2HrmYYlFw6Jg Project identifier. Value of the project.uid field.
Set header X-USER-EMAIL

Send a request to log in using POST api/auth/log_in.json described in the Auth API. Using the email address returned in the response, set: X-USER-EMAIL = data.email

Set header X-USER-TOKEN

Send a request to log in using POST api/auth/log_in.json described in the Auth API. Using the authentication token returned in the response, set: X-USER-TOKEN = data.token

Set header X-USER-PROJECT

Send a request to get projects using GET api/projects/ described in the Projects API. You must send this request with headers X-USER-EMAIL and X-USER-TOKEN already set. Using the project UID returned in the response, set: X-USER-PROJECT = projects[i].uid

Projects Endpoints

Functionality Method Endpoint
get projects GET api/projects
create project POST api/projects
update project PUT api/projects/{uid}
delete project DELETE api/projects/{uid}

Endpoints

Get projects

GET api/projects Get all projects accessible to the user that is currently logged in.

Response Fields

Field Description
projects A JSON object with the list of projects.
projects.uid The unique identifier for the project.
projects.name The name of the project.
projects.settings A JSON object with project settings.
projects.settings.zone_vertices_limit A maximum number of zone vertices that is created in project.
projects.user_params A JSON object with user-defined project parameters.
projects.user_params.address The address of the project.
projects.user_params.manager The manager of the project.
projects.user_params.timezone The timezone name of the project according to IANA.
projects.users The list of users of the project.
projects.priv Reserved field.

Example Response

{
  "projects": [
    {
      "uid": "0xa0mYr1eYFx4VK8vDXdmG",
      "name": "Project 1",
      "settings": {
        "zone_vertices_limit": 12
      },
      "user_params": {
        "address": "",
        "manager": "Manager 1",
        "timezone": "America/Los_Angeles"
      },
      "users": [],
      "priv": 5
    },
    {
      "uid": "tqDdZxdLtWtfsIDCVThe7G",
      "name": "Project 2",
      "settings": {
        "zone_vertices_limit": 12
      },
      "user_params": {
        "color": "#00ccff",
        "address": "",
        "manager": "Manager 1",
        "timezone": "America/Los_Angeles"
      },
      "users": [],
      "priv": 13
    }
  ]
}

Create project

POST api/projects Creates a new project.

Request Fields

Field Required/Optional Type Description
project - object A JSON object including information about the project.
project.name required string The name of the project.
project.user_params - object A JSON object with user-defined project parameters.
project.user_params.address optional string The address of the project.
project.user_params.manager optional string The manager of the project.
project.user_params.timezone required string The timezone name of the project according to IANA.

Response Fields

Field Description
id The project identifier in the database.
name The name of project.
taggings_count Reserved field.
settings Project settings.
user_params User-defined project parameters.
uid The unique identifier of the project.
scope Reserved field.
role_uid The unique identifier of the entity role in the database.
role_name The role of the entity created.
role_display_name Reserved field.

Example Request

{
  "project": {
    "name": "test project",
    "user_params": {
      "address": "123",
      "manager": "John Doe",
      "timezone": "America/Los_Angeles"
    }
  }
}

Example Response

{
  "id": 3919,
  "name": "test project",
  "taggings_count": 0,
  "settings": {
    "zone_vertices_limit": 12
  },
  "user_params": {
    "address": "123",
    "manager": "John Doe",
    "timezone": "America/Tijuana"
  },
  "uid": "XmdAftFV3JBqVbglt8T4jh",
  "scope": "Y",
  "role_uid": "N41CyOmA8VCmb0ojEXz5Bu",
  "role_name": "Project",
  "role_display_name": "Project"
}

Errors

Error Status Error Type Error Body Error Description
404 Not found {"message":"root tag not found", "name":"NotFoundError"} Could not find the tag role in the database.
404 Not found {"message":"TagRole .... not found", "name":"NotFoundError"} Could not find the tag role in the database.
422 Unprocessable Entity {"message":"Failed to create project", "name":"UnprocessableEntityError"} Could not validate data.
422 Unprocessable Entity {"message":"Project with name ... in company ... already exist", "name":"UnprocessableEntityError"} Could not create project with existing name.

Update project

PUT api/projects/{uid} Edit a project using a project UID. To retrieve a project UID, see get projects.

Request Fields

Field Required/Optional Type Description
project - object A JSON object including information about the project.
project.name required string The project name.
project.user_params optional object User-defined project parameters.

Response Fields

Field Description
project A JSON object including the updated project properties.
project.id The identifier of the project in the database.
project.name The name of the project.
project.taggings_count Reserved field.
project.user_params User-defined project parameters.
project.uid The unique identifier of the project.
project.scope Reserved field.
project.role_uid The unique identifier of the entity role in the database.
project.role_name The role name of the project.
project.role_display_name Reserved field.

Example Request

Using PUT api/projects/TP9m8x3fSyaswMm8dQUsHA:

{
  "project": {
    "name": "NEW_NAME",
    "user_params": {
      "manager": "John Doe",
      "timezone": "America/Los_Angeles"
    }
  }
}

Example Response

{
  "project": {
    "id": 32,
    "name": "NEW_NAME",
    "taggings_count": 0,
    "settings": {
      "zone_vertices_limit": 12
    },
    "user_params": {
      "color": "#FF3033",
      "role": "PROJECT",
      "manager": "Manager 1",
      "timezone": "America/Los_Angeles"
    },
    "uid": "TP9m8x3fSyaswMm8dQUsHA",
    "scope": "Y",
    "role_uid": "DhE-KsKqEeagPwhgboMCKw",
    "role_name": "Project",
    "role_display_name": "Project"
  }
}

Errors

Error Status Error Type Error Body Error Description
404 Not found {"message":"Project with uid ... not found", "name":"NotFoundError"} Could not find the project UID in the database.
422 Unprocessable Entity {"message":"...", "name":"UnprocessableEntityError"} The request data failed validation.
422 Unprocessable Entity {"message":"Project with name ... in company ... already exist", "name":"UnprocessableEntityError"} A project with this name already exists.
403 Forbidden User have no permission to update projects User do not have permissions to update project
403 Forbidden User have no permission to update project User do not have permissions to update project with exact uid

Delete project

DELETE api/projects/{uid} Deletes a project with a specified project UID. To retrieve a project UID, see get projects.

A successful request returns a status of 204.

results matching ""

    No results matching ""