Skip to content

API Projects

Brunovski edited this page Dec 28, 2020 · 17 revisions

GET /projects

Description: Retrieves the specified page of projects

Request:

  • Query String:
    • page (Integer, Optional) Page to retrieve. Default value is 0
  • Example:
curl --location --request GET 'http://localhost:8080/projects?provider=google'
--header 'Authorization: Bearer {Access Token}'

Success Response:

  • Status Code: 200 OK
  • Content: A list of objects with the resumed information of the projects
  • Content Type:
    • application/json
  • Schema:
[
   {
      "id": String
      "version": Integer
   },
   ...
]
  • Example:
[{"id": "8fdaea41-23ca-42cc-a3aa-063bb42bb842", "version": 1}, {"id": "62c8bab8-f4d4-4248-a646-d2b1dd50af8b", "version": 2}]

Error Responses:

  • 400 Bad Request
  • 401 Unauthorized

Role: User

GET /projects/{project}

Description: Retrieves the specified project

Request:

  • URI Params:
    • project (String) Project identifier
  • Query String:
    • version (Integer, Optional) Version of the project information. Default value is the current version
  • Example:
curl --location --request GET 'http://localhost:8080/projects/8fdaea41-23ca-42cc-a3aa-063bb42bb842?provider=google'
--header 'Authorization: Bearer {Access Token}'

Success Response:

  • Status Code: 200 OK
  • Content: An object with the information of the project
  • Content Type:
    • application/json
  • Schema:
{
   "id": String
   "version": Integer
   "deprecated": Boolean
   "name": String
   "visibility": String - "public" or "private"
   "description": String
   "users": [{"email": String, "provider": String}, ...]
}
  • Example:
{
   "id": "8fdaea41-23ca-42cc-a3aa-063bb42bb842", 
   "version": 1,
   "deprecated": false,
   "name": "Example Project",
   "visibility": "private",
   "description": "Example project",
   "users": [{"email": "[email protected]", "provider": "google"}, {"email": "[email protected]", "provider": "google"}]
}

Error Responses:

  • 404 Not Found
  • 401 Unauthorized

Role: User

PUT /projects/{project}

Description: Updates the specified project. The project is only updated if all users exists

Request:

  • URI Params:
    • project (String) Project identifier
  • Content: An object with the project information
  • Content Type:
    • application/json
  • Schema:
   "id": String
   "name": String
   "visibility": String - "public" or "private"
   "description": String
   "users": [{"email": String, "provider": String}, ...]
  • Example:
curl --location --request PUT 'http://localhost:8080/projects/b0145762-abb8-438b-a8a7-5800a633668a?provider=google'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer {Access Token}'
--data-raw '{
   "id": "b0145762-abb8-438b-a8a7-5800a633668a",
   "name": "Example Project",
   "visibility": "private",
   "description": "Example project, but changed",
   "users": [{"email": "[email protected]", "provider": "google"}, ...]
}'

Success Response:

  • Status Code: 204 No Content

Error Responses:

  • 400 Bad Request
  • 401 Unauthorized

Role: User

POST /projects

Description: Creates the specified project. The project is only created if all users exists

Request:

  • Content Type:
    • application/json
  • Content: An object with the project information
  • Schema:
{
   "name": String
   "visibility": String - "public" or "private"
   "description": String
   "users": [{"email": String, "provider": String}, ...]
}
  • Example:
curl --location --request POST 'http://localhost:8080/projects?provider=google'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer {Access Token}'
--data-raw '{
   "name": "Example Project",
   "visibility": "private",
   "description": "Example project, but new",
   "users": [{"email": "[email protected]", "provider": "google"}, ...]
}'

Success Response:

  • Status Code: 201 Created
  • Content: An object with an id to identify the created project
  • Content Type:
    • application/json
  • Schema:
{
   "id": String
}
  • Example:
{
   "id": "b0145762-abb8-438b-a8a7-5800a633668a"
}

Error Responses:

  • 400 Bad Request
  • 401 Unauthorized

Role: User

DELETE /projects/{project}

Description: Deprecates the specified project

Request:

  • URI Params:
    • project (String) Project identifier
  • Example:
curl --location --request DELETE 'http://localhost:8080/projects/b0145762-abb8-438b-a8a7-5800a633668a?provider=google'
--header 'Authorization: Bearer {Access Token}'

Success Response:

  • Status Code: 204 No Content

Error Responses:

  • 401 Unauthorized

Role: User