# API Doc

### Route Sandard

The routes are standardized with this rule:&#x20;

#### Find all

```http
GET /:role/:resources
```

> Ex: /developer/projects

#### Find one by id

```http
GET /:role/:resources/:id
```

> Ex: /admin/projects/1

#### Create

```http
POST /:role/:resources
```

> Ex: /admin/projects

#### Update

```http
PATCH /:role/:resources/:id/:field
```

> Ex: /admin/projects/1/name

#### Delete

```
DELETE /:role/:resources/:id
```

> Ex: /admin/projects

### Body standard

For a write request, the payload should follow this:

```json
{
    "resource": {
        "field_in_snake_case": "value"
    }
}
```

### Error message standard

The error messages are written in upper case and snake case

```bash
{RESOURCE}_{FIELD}_{ERROR REASON}
```

Ex: PROJECT\_NAME\_REQUIRED

### Authentication

<img src="https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2F3WbaE3lvjB83ERg4OUiy%2Ffile.excalidraw.svg?alt=media&#x26;token=74f6e294-6d03-4884-8271-3aee04f884f1" alt="Worfklow" class="gitbook-drawing">

{% openapi src="<https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2F5IMNuTq8SZYfmtI9SxKZ%2FOpenApiSpec%20(2).yaml?alt=media&token=0d7e27ef-0148-462d-8f73-63b91fffe4d7>" path="/api/auth/token" method="post" %}
[OpenApiSpec (2).yaml](https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2F5IMNuTq8SZYfmtI9SxKZ%2FOpenApiSpec%20\(2\).yaml?alt=media\&token=0d7e27ef-0148-462d-8f73-63b91fffe4d7)
{% endopenapi %}

This endpoint return a access token.

Keep it and send it in Authorization header for all secured endpoint

{% openapi src="<https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FapNcs1WhLghH68SJIa1q%2FOpenApiSpec.yaml?alt=media>" path="/api/user/info" method="get" %}
[OpenApiSpec.yaml](https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FapNcs1WhLghH68SJIa1q%2FOpenApiSpec.yaml?alt=media)
{% endopenapi %}

###

### Non standard endpoint

Launch a build from project

@Return executor id

{% openapi src="<https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FapNcs1WhLghH68SJIa1q%2FOpenApiSpec.yaml?alt=media>" path="/api/developer/builds/{projectId}" method="post" %}
[OpenApiSpec.yaml](https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FapNcs1WhLghH68SJIa1q%2FOpenApiSpec.yaml?alt=media)
{% endopenapi %}

@Return queued tasks

{% openapi src="<https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FapNcs1WhLghH68SJIa1q%2FOpenApiSpec.yaml?alt=media>" path="/api/developer/builds/queueds" method="get" %}
[OpenApiSpec.yaml](https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FapNcs1WhLghH68SJIa1q%2FOpenApiSpec.yaml?alt=media)
{% endopenapi %}

@Return executed build

{% openapi src="<https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FapNcs1WhLghH68SJIa1q%2FOpenApiSpec.yaml?alt=media>" path="/api/developer/builds/executeds" method="get" %}
[OpenApiSpec.yaml](https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FapNcs1WhLghH68SJIa1q%2FOpenApiSpec.yaml?alt=media)
{% endopenapi %}

Check if notification configuration working

@Return 200, even if the email is not sent

{% openapi src="<https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FapNcs1WhLghH68SJIa1q%2FOpenApiSpec.yaml?alt=media>" path="/api/admin/config/mail/test/{recipient}" method="post" %}
[OpenApiSpec.yaml](https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FapNcs1WhLghH68SJIa1q%2FOpenApiSpec.yaml?alt=media)
{% endopenapi %}

Ping, healtcheck

@Return void

{% openapi src="<https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FapNcs1WhLghH68SJIa1q%2FOpenApiSpec.yaml?alt=media>" path="/api/guest/ping" method="get" %}
[OpenApiSpec.yaml](https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FapNcs1WhLghH68SJIa1q%2FOpenApiSpec.yaml?alt=media)
{% endopenapi %}

@Return pagined project list

{% openapi src="<https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FapNcs1WhLghH68SJIa1q%2FOpenApiSpec.yaml?alt=media>" path="/api/developer/paginations/project" method="get" %}
[OpenApiSpec.yaml](https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FapNcs1WhLghH68SJIa1q%2FOpenApiSpec.yaml?alt=media)
{% endopenapi %}

@Return pagined developer list

{% openapi src="<https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FlTS645cD0ZEZRYMunLqG%2FOpenApiSpec%20(3).yaml?alt=media&token=29d27ec6-dd7e-4693-82d3-b70caaffc63f>" path="/api/developer/paginations/developer" method="get" %}
[OpenApiSpec (3).yaml](https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FlTS645cD0ZEZRYMunLqG%2FOpenApiSpec%20\(3\).yaml?alt=media\&token=29d27ec6-dd7e-4693-82d3-b70caaffc63f)
{% endopenapi %}

@Return pagined secret list

{% openapi src="<https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FlTS645cD0ZEZRYMunLqG%2FOpenApiSpec%20(3).yaml?alt=media&token=29d27ec6-dd7e-4693-82d3-b70caaffc63f>" path="/api/developer/paginations/secret" method="get" %}
[OpenApiSpec (3).yaml](https://910696449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F63PEX7D6niJNueQIYQit%2Fuploads%2FlTS645cD0ZEZRYMunLqG%2FOpenApiSpec%20\(3\).yaml?alt=media\&token=29d27ec6-dd7e-4693-82d3-b70caaffc63f)
{% endopenapi %}
