v1

latestSwagger 2.02026-07-1312672.0 KB
users

List posts by a user

get/users/{user_id}/posts

Path parameters

user_idstring required

The user ID of the user whose posts will be retrieved. Using 'me' as the user_id will return the posts for the current user.

Query parameters

sort_bystring

How to sort the posts that are returned. One of: date, active, distance <br /><br /> Date sorting will sort posts from newest to oldest. Active sorting will sort active posts before satisfied, withdrawn and expired posts and then sort by date. Distance sorting will sort the closest posts first.

typesstring required

A comma separated list of the post types to return. The available post types are: offer, wanted, admin

sourcesstring required

A comma separated list of the post sources to retrieve posts from. The available sources are: groups, trashnothing, open_archive_groups. The trashnothing source is for public posts that are posted on Trash Nothing but are not associated with any group. The open_archive_groups source provides a way to easily request posts from groups that have open_archives set to true without having to pass a group_ids parameter. When passed, it will automatically return posts from open archive groups that are within the area specified by the latitude, longitude and radius parameters (or all the open archive groups the requested user has posted to if latitude, longitude and radius aren't passed). <br /><br /> NOTE: For requests using an api key instead of oauth, passing the trashnothing source or the open_archive_groups source makes the latitude, longitude and radius parameters required.

group_idsstring

A comma separated list of the group IDs to retrieve posts from. This parameter is only used if the 'groups' source is passed in the sources parameter and only groups that the current user is a member of or that are open archives groups will be used (the group IDs of other groups will be silently discarded*). <br /><br /> NOTE: For requests using an api key instead of oauth, this field is required if the 'groups' source is passed. In addition, only posts from groups that have open_archives set to true will be used (the group IDs of other groups will be silently discarded*). <br /><br/> *To determine which group IDs were used and which were discarded, use the group_ids field in the response.

per_pageinteger

The number of posts to return per page (must be >= 1 and <= 100).

pageinteger

The page of posts to return.

device_pixel_rationumber

Client device pixel ratio used to determine thumbnail size (default 1.0).

latitudenumber

The latitude of a point around which to return posts.

longitudenumber

The longitude of a point around which to return posts.

radiusnumber

The radius in meters of a circle centered at the point defined by the latitude and longitude parameters. When latitude, longitude and radius are passed, only posts within the circle defined by these parameters will be returned.

date_minstring date-time

Only posts newer than or equal to this UTC date and time will be returned.

date_maxstring date-time

Only posts older than this UTC date and time will be returned.

outcomesstring

A comma separated list of the post outcomes to return. The available post outcomes are: satisfied, withdrawn <br /><br /> There are also a couple special values that can be passed. If set to an empty string (the default), only posts that are not satisfied and not withdrawn and not expired are returned. If set to 'all', all posts will be returned no matter what outcome the posts have. If set to 'not-promised', only posts that are not satisfied ant not withdrawn and not expired and not promised are returned.

include_repostsinteger

If set to 1 (the default), posts that are reposts will be included. If set to 0, reposts will be excluded. See the repost_count field of post objects for details about how reposts are identified.

Response

The posts and paging data.

num_postsinteger

The total number of posts available.

pageinteger

The page number of the posts being returned.

per_pageinteger

The number of posts being returned per page.

num_pagesinteger

The total number of pages available.

start_indexinteger

The index of the first post being returned (an integer between 1 and num_posts).

end_indexinteger

The index of the last post being returned (an integer between start_index and num_posts).

group_idsstring[]

The IDs of the groups that the posts were retrieved from (will be null when no group IDs were used). These IDs may be a subset of the requested group IDs when a request includes group IDs for groups that are not open archives and that the current user is not a member of. If the open_archive_groups source is used, these IDs may include the IDs of open archive groups that weren't present in the group_ids parameter of the request.

last_listings_viewstring date-time

The UTC date and time when the current user last viewed the newest posts on the All Posts page (may be null). <br /><br /> NOTE: For this to be accurate, clients must update the last_listings_view property of the current user every time the user is shown the newest posts on the All Posts page. <br /><br /> NOTE: For requests using an api key instead of oauth, this field is always null.

Example response

{
  "posts": [
    {
      "post_id": 3171898,
      "group_id": 6,
      "user_id": 2933,
      "title": "Ultrasonic diffuser (Downtown Toronto)",
      "content": "This ultrasonic diffuser creates an aroma in your home. It comes with two essential oils - mint and lavender.",
      "date": "2018-02-05T15:10:21",
      "type": "offer",
      "outcome": "satisfied",
      "latitude": 43.653226,
      "longitude": -79.383184,
      "footer": null,
      "photos": [
        {
          "photo_id": "695624-768616",
          "thumbnail": "https://trashnothing.com/img/2018-02-05/cfsbfm-39051735845_379baab73f.90x120.jpg",
          "url": "https://trashnothing.com/img/2018-02-05/cfsbfm-39051735845_379baab73f.375x500.jpg",
          "images": [
            {
              "url": "https://trashnothing.com/img/2018-02-05/cfsbfm-39051735845_379baab73f.90x120.jpg",
              "width": 90,
              "height": 120
            },
            {
              "url": "https://trashnothing.com/img/2018-02-05/cfsbfm-39051735845_379baab73f.180x240.jpg",
              "width": 180,
              "height": 240
            },
            {
              "url": "https://trashnothing.com/img/2018-02-05/cfsbfm-39051735845_379baab73f.270x360.jpg",
              "width": 270,
              "height": 360
            },
            {
              "url": "https://trashnothing.com/img/2018-02-05/cfsbfm-39051735845_379baab73f.375x500.jpg",
              "width": 375,
              "height": 500
            }
          ]
        }
      ],
      "expiration": "2018-03-05T15:10:21",
      "reselling": false,
      "url": "https://trashnothing.com/post/3171898/ultrasonic-diffuser-downtown-torronto",
      "repost_count": 1
    }
  ]
}
All 12 operations