# Posts

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/posts" method="get" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/posts/{id}" method="get" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

## Add new post

<mark style="color:green;">`POST`</mark> `https://ushahididocs.api.ushahidi.io /api/v3/posts`

#### Request Body

| Name              | Type    | Description                                                                  |
| ----------------- | ------- | ---------------------------------------------------------------------------- |
| form\_id          | String  | Form unique identifier                                                       |
| slug              | String  | Post slug                                                                    |
| type              | String  | Post type                                                                    |
| message           | String  | Additiong message for post                                                   |
| url               | String  | Post URL                                                                     |
| author\_email     | String  | Email address of source                                                      |
| title             | String  | Title of the new post                                                        |
| content           | String  | Post content                                                                 |
| user\_id          | Integer | The user's unique Identifier                                                 |
| author\_realname  | String  | The full name of the Post source                                             |
| status            | String  | The status of post                                                           |
| locale            | String  | Post local language                                                          |
| color             | String  | Post color                                                                   |
| id                | String  | Unique identifier for new post                                               |
| parent\_id        | Integer | Parent ID for new post                                                       |
| values            | Object  | This is an array containing two items, one for the title and the description |
| completed\_stages | Array   | Contains an array of post-completed stage                                    |
| published\_to     | Array   | This contains an array of where the post was published                       |
| source            | String  | Source of post                                                               |
| sets              | Array   | An array of set id's                                                         |
| tags              | Array   | Contains an object of tag Id's                                               |
| contact           | String  | Post contact                                                                 |

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

```javascript
{
  "id": 0,
  "url": "string",
  "user_id": 0,
  "parent_id": 0,
  "form_id": 0,
  "title": "string",
  "content": "string",
  "message": "string",
  "color": "string",
  "type": "string",
  "slug": "string",
  "author_email": "string",
  "author_realname": 0,
  "status": "string",
  "created": "string",
  "updated": "string",
  "locale": "string",
  "values": [
    "string"
  ],
  "post_date": "string",
  "tags": [
    "string"
  ],
  "published_to": [
    0
  ],
  "completed_stages": [
    0
  ],
  "sets": [
    0
  ],
  "lock": "string",
  "source": "string",
  "data_source_message_id": "string",
  "allowed_privileges": [
    "string"
  ]
}
```

{% endtab %}
{% endtabs %}

## Edit a post by ID

<mark style="color:orange;">`PUT`</mark> `https://ushahididocs.api.ushahidi.io/api/v3/posts/{id}`

#### Path Parameters

| Name                                 | Type    | Description         |
| ------------------------------------ | ------- | ------------------- |
| id<mark style="color:red;">\*</mark> | integer | The post identifier |

#### Request Body

| Name             | Type    | Description                                                                  |
| ---------------- | ------- | ---------------------------------------------------------------------------- |
| form\_id         | Integer | Form unique identifier                                                       |
| slug             | String  | Post slug                                                                    |
| type             | String  | Post type                                                                    |
| message          | String  | Additiong message for post                                                   |
| url              | String  | Post URL                                                                     |
| author\_email    | String  | Email address of source                                                      |
| title            | String  | Title of the new post                                                        |
| content          | String  | Post content                                                                 |
| user\_id         | Integer | The user's unique Identifier                                                 |
| author\_realname | String  | The full name of the Post source                                             |
| status           | String  | The status of post                                                           |
| locale           | String  | Post local language                                                          |
| color            | String  | Post color                                                                   |
| id               | String  | Unique identifier of post                                                    |
| values           | String  | This is an array containing two items, one for the title and the description |
| published\_to    | Array   | This contains an array of where the post was published                       |
| source           | String  | Source of post                                                               |
| sets             | String  | An array of set id's                                                         |
| tags             | String  | Contains an array of tag Id's                                                |
| contact          | String  | Post contact                                                                 |

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

```javascript
{
  "id": 0,
  "url": "string",
  "user_id": 0,
  "parent_id": 0,
  "form_id": 0,
  "title": "string",
  "content": "string",
  "message": "string",
  "color": "string",
  "type": "string",
  "slug": "string",
  "author_email": "string",
  "author_realname": 0,
  "status": "string",
  "created": "string",
  "updated": "string",
  "locale": "string",
  "values": [
    "string"
  ],
  "post_date": "string",
  "tags": [
    "string"
  ],
  "published_to": [
    0
  ],
  "completed_stages": [
    0
  ],
  "sets": [
    0
  ],
  "lock": "string",
  "source": "string",
  "data_source_message_id": "string",
  "allowed_privileges": [
    "string"
  ]
}
```

{% endtab %}
{% endtabs %}

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/posts/{id}" method="delete" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/posts/stats" method="get" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/posts/geojson" method="get" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/posts/geojson/{zoom}/{x}/{y}" method="get" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/posts/{post\_id}/geojson" method="get" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/posts/{post\_id}/lock" method="put" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/posts/{post\_id}/lock" method="delete" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

## Sub Posts & Translation

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/posts/{parent\_id}/revisions" method="get" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/posts/{parent\_id}/revisions/105" method="get" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/posts/{parent\_id}/translations" method="get" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/posts/{parent\_id}/translations/{translation\_id}" method="get" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

## Add a post translation

<mark style="color:green;">`POST`</mark> `https://ushahididocs.api.ushahidi.io/api/v3/posts/{parent_id}/translations`

#### Path Parameters

| Name                                           | Type   | Description       |
| ---------------------------------------------- | ------ | ----------------- |
| parent\_id\*<mark style="color:red;">\*</mark> | String | Parent Identifier |

#### Request Body

| Name              | Type   | Description                                                      |
| ----------------- | ------ | ---------------------------------------------------------------- |
| content           | String | Post content                                                     |
| type              | String | Post type                                                        |
| author\_email     | String | Email address of source                                          |
| message           | String | Additional message for post                                      |
| url               | String | Post URL                                                         |
| id                | String | Post unique identifier                                           |
| slug              | String | Post slug                                                        |
| user\_id          | String | Post user indentifier                                            |
| color             | String | Post color                                                       |
| title             | String | Post Tiitle                                                      |
| locale            | String | The local language of post                                       |
| status            | String | Post status                                                      |
| author\_realname  | String | The full name of the Post source                                 |
| published\_to     | Array  | This contains an array of where the post was published           |
| completed\_stages | Array  | Contains an array of post-completed stage                        |
| source            | String | The Source of the post contains an array of post-completed stage |

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

```javascript
{
    "id": 10000,
    "url": "http://localhost:8000/api/v3/posts/10000",
    "parent": {
        "id": 97,
        "url": "http://localhost:8000/api/v3/posts/97"
    },
    "form": null,
    "user_id": null,
    "message": null,
    "color": null,
    "type": "report",
    "title": "creat post",
    "slug": "test-create6",
    "content": "test: create new post",
    "author_email": "er@et.com",
    "author_realname": null,
    "status": "draft",
    "created": "2022-09-02T08:34:57+00:00",
    "updated": null,
    "locale": "fr_fr",
    "values": {
        "markdown": [
            "#markdowny"
        ]
    },
    "post_date": "2022-09-02T08:34:57+00:00",
    "tags": [],
    "published_to": [],
    "completed_stages": [],
    "sets": [],
    "lock": null,
    "source": null,
    "contact": null,
    "data_source_message_id": null,
    "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search",
        "change_status",
        "read_full"
    ]
}
```

{% endtab %}
{% endtabs %}

## Edit post translation

<mark style="color:orange;">`PUT`</mark> `https://ushahididocs.api.ushahidi.io/api/v3/posts/{parent_id}/translations/{translation_id}`

#### Path Parameters

| Name                                              | Type    | Description            |
| ------------------------------------------------- | ------- | ---------------------- |
| parent\_id<mark style="color:red;">\*</mark>      | Integer | Parent Identifier      |
| translation\_id<mark style="color:red;">\*</mark> | integer | Translation Identifier |

#### Request Body

| Name             | Type   | Description                                                      |
| ---------------- | ------ | ---------------------------------------------------------------- |
| id               | String | Post unique identifier                                           |
| published\_to    | Array  | Contains an array of post-completed stage                        |
| locale           | String | The local language of the post                                   |
| status           | String | Post status                                                      |
| author\_realname | String | The full name of the Post source                                 |
| author\_email    | String | The full name of the Post source                                 |
| type             | String | Post type                                                        |
| color            | String | Post color                                                       |
| message          | String | Post message                                                     |
| content          | String | Content of post                                                  |
| title            | String | Post title                                                       |
| user\_id         | String | Post user identifier                                             |
| url              | String | Post URL                                                         |
| source           | String | The Source of the post contains an array of post-completed stage |

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

```javascript
{
    "id": 10000,
    "url": "http://localhost:8000/api/v3/posts/10000",
    "parent": {
        "id": 97,
        "url": "http://localhost:8000/api/v3/posts/97"
    },
    "form": null,
    "user_id": null,
    "message": null,
    "color": null,
    "type": "report",
    "title": "creat post",
    "slug": "test-create6",
    "content": "test: create new post",
    "author_email": "er@et.com",
    "author_realname": null,
    "status": "draft",
    "created": "2022-09-02T08:34:57+00:00",
    "updated": null,
    "locale": "fr_fr",
    "values": {
        "markdown": [
            "#markdowny"
        ]
    },
    "post_date": "2022-09-02T08:34:57+00:00",
    "tags": [],
    "published_to": [],
    "completed_stages": [],
    "sets": [],
    "lock": null,
    "source": null,
    "contact": null,
    "data_source_message_id": null,
    "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search",
        "change_status",
        "read_full"
    ]
}
```

{% endtab %}
{% endtabs %}

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/posts/{parent\_id}/translations/{translation\_id}" method="delete" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/posts/{parent\_id}/translations/(local)" method="get" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

## Edit post local translation

<mark style="color:orange;">`PUT`</mark> `https://ushahididocs.api.ushahidi.io/api/v3/posts/{parent_id}/translations/(local)`

#### Path Parameters

| Name                                         | Type    | Description       |
| -------------------------------------------- | ------- | ----------------- |
| parent\_id<mark style="color:red;">\*</mark> | Integer | Parent Identifier |
| local<mark style="color:red;">\*</mark>      | String  | Post locale       |

#### Request Body

| Name             | Type    | Description                                                      |
| ---------------- | ------- | ---------------------------------------------------------------- |
| id               | String  | Post unique identifier                                           |
| published\_to    | Array   | Contains an array of post-completed stage                        |
| locale           | String  | The local language of the post                                   |
| status           | String  | Post status                                                      |
| author\_realname | String  | The full name of the Post source                                 |
| author\_email    | String  | The full name of the Post source                                 |
| type             | String  | Post type                                                        |
| color            | String  | Post color                                                       |
| message          | String  | Post message                                                     |
| content          | String  | Content of post                                                  |
| title            | String  | Post title                                                       |
| user\_id         | Integer | Post user identifier                                             |
| url              | String  | Post URL                                                         |
| source           | String  | The Source of the post contains an array of post-completed stage |
| form\_id         | Integer | Post form identifier                                             |

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

```javascript
{
    "id": 10000,
    "url": "http://localhost:8000/api/v3/posts/10000",
    "parent": {
        "id": 97,
        "url": "http://localhost:8000/api/v3/posts/97"
    },
    "form": null,
    "user_id": null,
    "message": null,
    "color": null,
    "type": "report",
    "title": "creat post",
    "slug": "test-create6",
    "content": "test: create new post",
    "author_email": "er@et.com",
    "author_realname": null,
    "status": "draft",
    "created": "2022-09-02T08:34:57+00:00",
    "updated": null,
    "locale": "fr_fr",
    "values": {
        "markdown": [
            "#markdowny"
        ]
    },
    "post_date": "2022-09-02T08:34:57+00:00",
    "tags": [],
    "published_to": [],
    "completed_stages": [],
    "sets": [],
    "lock": null,
    "source": null,
    "contact": null,
    "data_source_message_id": null,
    "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search",
        "change_status",
        "read_full"
    ]}
```

{% endtab %}
{% endtabs %}

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/posts/{parent\_id}/translations/(local)" method="delete" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}
