# Project

## Method & Permission

| API            | GET                                                    | POST                     | PUT | PATCH                | DELETE |
| -------------- | ------------------------------------------------------ | ------------------------ | --- | -------------------- | ------ |
| Project List   | Admin, Project Admin\*, Project Edit\*, Project View\* | Admin, Project Admin\*\* | -   | -                    | -      |
| Project Detail | Admin, Project Admin, Project Edit, Project View       | -                        | -   | Admin, Project Admin | -      |

\*Can only view/edit the project they are allowed to view/edit

\*\* Project Admin can only create sub projects.

## Project List

<mark style="color:blue;">`GET`</mark> `{{ base_url }} /projects/project/list/{level}/{sid}/{serializer}/`

#### Path Parameters

| Name       | Type   | Description      |
| ---------- | ------ | ---------------- |
| level      | string | organization     |
| sid        | string | organization sid |
| serializer | string |                  |

#### Headers

| Name  | Type   | Description |
| ----- | ------ | ----------- |
| token | string |             |

{% tabs %}
{% tab title="200 " %}

```yaml
# serializer = name
{
    "page_size": 10,
    "page_number": 1,
    "page_count": 1,
    "count": 2,
    "next": null,
    "previous": null,
    "add_permission": true,
    "results": [
        {
            "sid": "xxx",
            "name": "Sample Project"
        },
        ...
    ]
}
# serializer = list
{
    "page_size": 10,
    "page_number": 1,
    "page_count": 1,
    "count": 2,
    "next": null,
    "previous": null,
    "add_permission": true,
    "results": [
        {
            "sid": "xxx",
            "name": "Sample Project",
            "parent": null,
            "description": "This is a sample project created automatically. Please archive it on your production data.",
            "date_start": "2020-02-10",
            "date_end": null,
            "is_archived": false,
            "change_permission": true
        },
        ...
    ]
}
# serializer = detail
{
    "page_size": 10,
    "page_number": 1,
    "page_count": 1,
    "count": 2,
    "next": null,
    "previous": null,
    "add_permission": true,
    "results": [
        {
            "sid": "xxx",
            "name": "Sample Project",
            "parent": null,
            "description": "This is a sample project created automatically. Please archive it on your production data.",
            "date_start": "2020-02-10",
            "date_end": null,
            "should_receive_weekly_digest": true,
            "open_to_organization": false,
            "open_to_public": false,
            "metadata": [
                
            ],
            "is_archived": false,
            "number_of_records": 0,
            "updated_by": "xxx",
            "date_updated": "2020-02-10T03:02:22.241376Z",
            "date_created": "2020-02-10T03:02:22.240056Z",
            "change_permission": true
        },
        ...
    ]
}
```

{% endtab %}
{% endtabs %}

## Project List

<mark style="color:green;">`POST`</mark> `{{ base_url }} /projects/project/list/{level}/{sid}/{serializer}/`

#### Path Parameters

| Name       | Type   | Description      |
| ---------- | ------ | ---------------- |
| level      | string | sid              |
| sid        | string | organization sid |
| serializer | string |                  |

#### Headers

| Name  | Type   | Description |
| ----- | ------ | ----------- |
| token | string |             |

#### Request Body

| Name                   | Type    | Description |
| ---------------------- | ------- | ----------- |
| name                   | string  |             |
| description            | string  |             |
| date\_start            | string  |             |
| date\_end              | string  |             |
| is\_archived           | boolean |             |
| open\_to\_organization | boolean |             |
| metadata               | object  |             |

{% tabs %}
{% tab title="201 " %}

```yaml
{
    "sid": "xxx",
    "name": "Sample Project",
    "parent": null,
    "description": "This is a sample project created automatically. Please archive it on your production data.",
    "date_start": "2020-02-10",
    "date_end": null,
    "should_receive_weekly_digest": true,
    "open_to_organization": false,
    "open_to_public": false,
    "metadata": [
        
    ],
    "is_archived": false,
    "number_of_records": 0,
    "updated_by": "xxx",
    "date_updated": "2020-02-10T03:02:22.241376Z",
    "date_created": "2020-02-10T03:02:22.240056Z",
    "change_permission": true
}
```

{% endtab %}
{% endtabs %}

## Project Detail

<mark style="color:blue;">`GET`</mark> `{{ base_url }} /projects/project/detail/{sid}/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| sid  | string |             |

#### Headers

| Name  | Type   | Description |
| ----- | ------ | ----------- |
| token | string |             |

{% tabs %}
{% tab title="200 " %}

```yaml
{
    "sid": "xxx",
    "name": "Sample Project",
    "parent": null,
    "description": "This is a sample project created automatically. Please archive it on your production data.",
    "date_start": "2020-02-10",
    "date_end": null,
    "should_receive_weekly_digest": true,
    "open_to_organization": false,
    "open_to_public": false,
    "metadata": [
        
    ],
    "is_archived": false,
    "number_of_records": 0,
    "updated_by": "xxx",
    "date_updated": "2020-02-10T03:02:22.241376Z",
    "date_created": "2020-02-10T03:02:22.240056Z",
    "change_permission": true
}
```

{% endtab %}
{% endtabs %}

## Project Detail

<mark style="color:purple;">`PATCH`</mark> `{{ base_url }} /projects/project/detail/{sid}/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| sid  | string |             |

#### Headers

| Name  | Type   | Description |
| ----- | ------ | ----------- |
| token | string |             |

#### Request Body

| Name                   | Type    | Description |
| ---------------------- | ------- | ----------- |
| name                   | string  |             |
| description            | string  |             |
| date\_start            | string  |             |
| date\_end              | string  |             |
| is\_archived           | boolean |             |
| open\_to\_organization | boolean |             |
| metadata               | object  |             |

{% tabs %}
{% tab title="200 " %}

```yaml
{
    "sid": "xxx",
    "name": "Sample Project",
    "parent": null,
    "description": "This is a sample project created automatically. Please archive it on your production data.",
    "date_start": "2020-02-10",
    "date_end": null,
    "should_receive_weekly_digest": true,
    "open_to_organization": false,
    "open_to_public": false,
    "metadata": [
        
    ],
    "is_archived": false,
    "number_of_records": 0,
    "updated_by": "xxx",
    "date_updated": "2020-02-10T03:02:22.241376Z",
    "date_created": "2020-02-10T03:02:22.240056Z",
    "change_permission": true
}
```

{% endtab %}
{% endtabs %}
