<commit_before>## Posts

All `v3 /posts` endpoints require the `activity` scope. `Create`/`update`/`delete` endpoints also require the `write` scope.

## Retrieve All Posts

```
GET /api/v3/posts
```

Posts are returned in reverse chronological order.

Only admins and post owners will have `tags`, `source`, `remote_addr` (which will be `0.0.0.0` for all posts in compliance with GDPR), and hidden posts (posts that are tagged 'Hide In Gallery') returned in the response.

Anonymous requests will only return accepted posts. Logged-in users can see accepted posts & any of their own pending or rejected posts. Staff can see anything!

If the post's action is marked as "anonymous", the `northstar_id` field will only be returned for the owner.

### Optional Query Parameters

- **limit**
  - Set the number of records to return in a single response.
  - e.g. `/posts?limit=35`
- **page** _(integer)_
  - For pagination, specify page of activity to return in the response.
  - e.g. `/posts?page=2`
- **filter[signup_id]** _(integer)_
  - The signup ID to filter the response by.
  - e.g. `/posts?filter[signup_id]=47`
- **filter[campaign_id]** _(integer)_
  - The campaign ID to filter the response by.
  - e.g. `/posts?filter[campaign_id]=47`
- **filter[northstar_id]** _(integer)_
  - The northstar_id to filter the response by.
  - e.g. `/posts?filter[northstar_id]=47asdf23abc`
- **filter[status]** _(string)_
  - The status to filter the response by.
  - e.g. `/posts?filter[status]=accepted`
- **filter[type]** _(string)_
  - The type to filter the response by.
  - e.g. `/posts?filter[type]=photo,voter-reg`
- **filter[action]** _(string)_
  - The action to filter the response by.
  - e.g. `/posts?filter[action]=action-1`
- **filter[action_id]** _(string)_
  - The action id to filter the response by.
  - e.g. `/posts?filter[action_id]=1`
- **filter[created_at]** _(timestamp)_
  - The created_at date to filter the response by.
  - e.g. `/posts?filter[created_at]=2017-04-28 01:46:45`
- **filter[exclude]** _(integer)_
  - The post id(s) to exclude in response.
  - e.g. `/posts?filter[exclude]=2,3,4`
- **filter[tag]** _(string)_
  - The tag(s) to filter the response by.
  - Tag is passed in as tag_slug.
  - e.g. `/posts?filter[tag]=good-submission,good-for-sponsor`
- **filter[source]** _(string)_
  - The source(s) to filter the response by.
  - e.g. `/posts?filter[source]=sms`
- **include** _(string)_
  - Include additional related records in the response: `signup`, `siblings`
  - e.g. `/posts?include=signup,siblings`
  - Note: siblings will only load up to 5 siblings (for performance reasons).

Example Response:

```
{
    "data": [
        {
            "id": 2984,
            "signup_id": 4673,
            "type": "photo",
            "action": "default",
            "action_id": 1,
            "northstar_id": "123",
            "media": {
                "url": "http://rogue.test/images/914",
                "original_image_url": "http://rogue.test/storage/uploads/reportback-items/476-923df5957838355206574f72d5520f0f-1548449285.jpeg?time=1548449285",
                "text": null
            },
            "quantity": "12",
            "reactions": {
                "reacted": true,
                "total": 2<commit_msg>Updating the API endpoint docs to include the new location filter.<commit_after>## Posts

All `v3 /posts` endpoints require the `activity` scope. `Create`/`update`/`delete` endpoints also require the `write` scope.

## Retrieve All Posts

```
GET /api/v3/posts
```

Posts are returned in reverse chronological order.

Only admins and post owners will have `tags`, `source`, `remote_addr` (which will be `0.0.0.0` for all posts in compliance with GDPR), and hidden posts (posts that are tagged 'Hide In Gallery') returned in the response.

Anonymous requests will only return accepted posts. Logged-in users can see accepted posts & any of their own pending or rejected posts. Staff can see anything!

If the post's action is marked as "anonymous", the `northstar_id` field will only be returned for the owner.

### Optional Query Parameters

- **limit**
  - Set the number of records to return in a single response.
  - e.g. `/posts?limit=35`
- **page** _(integer)_
  - For pagination, specify page of activity to return in the response.
  - e.g. `/posts?page=2`
- **filter[signup_id]** _(integer)_
  - The signup ID to filter the response by.
  - e.g. `/posts?filter[signup_id]=47`
- **filter[campaign_id]** _(integer)_
  - The campaign ID to filter the response by.
  - e.g. `/posts?filter[campaign_id]=47`
- **filter[northstar_id]** _(integer)_
  - The northstar_id to filter the response by.
  - e.g. `/posts?filter[northstar_id]=47asdf23abc`
- **filter[status]** _(string)_
  - The status to filter the response by.
  - e.g. `/posts?filter[status]=accepted`
- **filter[type]** _(string)_
  - The type to filter the response by.
  - e.g. `/posts?filter[type]=photo,voter-reg`
- **filter[action]** _(string)_
  - The action to filter the response by.
  - e.g. `/posts?filter[action]=action-1`
- **filter[action_id]** _(string)_
  - The action id to filter the response by.
  - e.g. `/posts?filter[action_id]=1`
- **filter[created_at]** _(timestamp)_
  - The created_at date to filter the response by.
  - e.g. `/posts?filter[created_at]=2017-04-28 01:46:45`
- **filter[exclude]** _(integer)_
  - The post id(s) to exclude in response.
  - e.g. `/posts?filter[exclude]=2,3,4`
- **filter[tag]** _(string)_
  - The tag(s) to filter the response by.
  - Tag is passed in as tag_slug.
  - e.g. `/posts?filter[tag]=good-submission,good-for-sponsor`
- **filter[source]** _(string)_
  - The source(s) to filter the response by.
  - e.g. `/posts?filter[source]=sms`
- **filter[location]** _(string)_
  - The location to filter the response by.
  - e.g. `/posts?filter[location]=US-NY`
- **include** _(string)_
  - Include additional related records in the response: `signup`, `siblings`
  - e.g. `/posts?include=signup,siblings`
  - Note: siblings will only load up to 5 siblings (for performance reasons).

Example Response:

```
{
    "data": [
        {
            "id": 2984,
            "signup_id": 4673,
            "type": "photo",
            "action": "default",
            "action_id": 1,
            "northstar_id": "123",
            "media": {
                "url": "http://rogue.test/images/914",
                "original_image_url": "http://rogue.test/storage/uploads/reportback-items/476-923df5957838355206574f72d5520f0f-1548449285.jpeg?time=1548449285",
                "text": null
            },
            "quantity": "12",
            "reactions": {
                "reacted": true,
                "total": 2
{'fraction_non_alphanumeric': 0.1472787081339713, 'fraction_numerical': 0.03110047846889952, 'mean_word_length': 3.0637910085054676, 'pattern_counts': {'":': 30, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5488637', 'n_tokens_mistral': 2358, 'n_tokens_neox': 2192, 'n_words': 670}