trash nothing
  1. posts
trash nothing
  • messages
    • List conversations
      GET
    • Mark all conversations as read
      PUT
    • Search conversations
      GET
    • Delete conversation
      DELETE
    • Archive conversation
      PUT
    • Block conversation
      PUT
    • Mark conversation as read
      PUT
    • List conversation messages
      GET
    • Reply to conversation
      POST
    • Report conversation
      POST
    • Unarchive conversation
      PUT
    • Unblock conversation
      PUT
  • misc
    • Send feedback
  • groups
    • Search groups
    • Retrieve multiple groups
    • Join groups
    • Retrieve a group
    • Submit group answers
    • Contact group moderators
    • Leave a group
  • photos
    • Create a photo
    • Retrieve multiple photos
    • Delete a photo
    • Rotate a photo
  • posts
    • List posts
      GET
    • Submit a post
      POST
    • List all posts
      GET
    • List all post changes
      GET
    • Retrieve client.js
      GET
    • Retrieve multiple posts
      GET
    • Search posts
      GET
    • Retrieve a post
      GET
    • Update a post
      PUT
    • Delete a post bookmark
      DELETE
    • Bookmark a post
      PUT
    • Retrieve post display data
      GET
    • Flag a post
      POST
    • Map a post
      PUT
    • Promise an offer post
      PUT
    • Reply to a post
      POST
    • Satisfy a post
      PUT
    • Share a post
      POST
    • Unpromise an offer post
      PUT
    • Withdraw a post
      PUT
  • stories
    • List stories
    • Submit a story
    • Retrieve a story
    • Like a story
    • Unlike a story
    • Record story viewed
  • users
    • Retrieve current user
    • Update current user
    • List current users' email alerts
    • Create an email alert
    • Delete an email alert
    • Change email address
    • Set users' email address as not bouncing
    • List current users' groups
    • Update location
    • List current users' group notices
    • List current users' post locations
    • Save a post location for the current user
    • List current users' posts
    • Search current users' posts
    • Set a profile image
    • List current users' profile images
    • Resend account verification email
    • Send password reset email
    • Report a user
    • Retrieve a user
    • Retrieve user display info
    • Submit feedback on a user
    • List posts by a user
    • Search posts by a user
    • Retrieve a users' profile image
  1. posts

Update a post

PUT
/posts/{post_id}
posts
Users can update posts to fix mistakes with their post, add photos, or add more details about the items. Updates should not be used to say that items in a post have been taken or received since the post satisfy endpoint is designed to do that.
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request PUT 'https://trashnothing.com/api/v1.2/posts/' \
--form 'location=""' \
--form 'session=""' \
--form 'title=""' \
--form 'type=""'
Response Response Example
200 - Example 1
{
    "identifier": "string",
    "message": "string",
    "preference_key": "string",
    "result": "string",
    "session": {
        "property1": "string",
        "property2": "string"
    }
}

Request

Path Params
post_id
string 
required
The ID of the post to update.
Body Params multipart/form-data
content
string 
optional
A longer description of the item(s).
expires_in
string 
optional
When the post should expire. Any amount of time from 1 hour to 90 days can be provided. To pass a number of hours, provide the number of hours prefixed by 'h' (eg. 1hr 24hr). To pass a number of days, provide the number of days prefixed by 'd' (eg. 1d 90d).

Note that updates may not appear instantly after submission because the volunteer moderators of many groups may have additional automatic or manual review processes in place that can cause delays. So with short expirations (eg. < 8 hours), there is a chance that the post may expire before the update is approved and so it will never be published.


NOTE: The max expiration for a post is 90 days after the post is published. So updates to posts that try to set an longer expiration will be silently changed to just apply the max expiration.
fair_offer
string 
optional
If set to 1, the post will be posted with the Fair Offer Policy (only valid for offer posts - see https://trashnothing.com/fair_offer_policy ).
latitude
string 
optional
The latitude corresponding to the location description provided.

If latitude and longitude are not provided, an attempt will be made to automatically geocode the location. If the location is unable to be geocoded, the post will be rejected* and will have to be resubmitted with a latitude and longitude corresponding to the location or resubmitted with a different location that can be automatically geocoded.

NOTE: The latitude and longitude should NOT be the users' exact location because we don't want to publicize their exact location unless their location description is their full address (which is not recommended).

*When a post is rejected because it can't be geocoded, the returned error will have its identifier property set to 'unknown-location'.
location
string 
required
A short location description.
longitude
string 
optional
The longitude corresponding to the location description provided. (see the NOTE in latitude description)
photo_ids
string 
optional
A comma separated list of the IDs of the photos that should be attached to this post.
preferences
string 
optional
A JSON string representing a permanent object that the client persists and modifies based on warnings returned by the update submission process and user input. Some warnings returned after submitting an update have a preference_key string property so that users can opt out of those warnings in the future. To save this opt-out preference, set the property indicated by the preference_key in the preferences object (eg. preferences[preference_key] = 1). The preferences object is never modified by the server - it is up to the client to initialize, modify and persist the preferences object.
session
string 
required
A JSON string representing a temporary object that is used to store data about the update process for a single post. The first time a post update is submitted, session should be a new empty object (eg. '{}'). The session object should be persisted by the client until that update is successfully submitted and then it can be discarded so that the next update will start over with a new empty session object. Every time an update is submitted and the response indicates that the submission was not successful, the session object returned in the response should override the clients copy of the session.
title
string 
required
A short description of the item(s).
type
string 
required
The type of post. One of: offer, wanted

Responses

🟢200Post update result.
application/json
Body
identifier
string 
optional
When an error or warning is returned, this will contain a short string representing the type of error or warning that occurred. Is null on success.
message
string 
optional
Contains text describing the reason a post update was not successful. Is null on success.
preference_key
string 
optional
Certain types of warnings can be opted out of. These warnings will set preference_key to a string that can be set in the preferences object by the client to opt out of that type of warning in the future (see the description of the preferences parameter for more details). Is null for errors, success and warnings that can't be opted out of.
result
string 
optional
One of: success, error, warning.

A success result indicates that the post update was submitted successfully. Note that post updates may not appear instantly after submission because the volunteer moderators of many groups may have additional automatic or manual review processes in place that can cause delays.

An error result indicates that there is an error with the post that should be shown to the user and the message property will contain text describing the error.

A warning result indicates that there is a warning about the post update to show the user and the message property will contain a string describing the warning. A warning result doesn't prevent a post update from being submitted, to continue the submission process after a warning result, just re-submit (with the updated session object) to temporarily override that specific warning.
session
object 
optional
The updated session object that should override the client's copy of the session that was passed in the session parameter. Is null on success.
Additional properties
string 
optional
🟠400Missing or invalid parameters.
🟠403The user doesn't have permission to edit the post.
🟠404Post not found.
Modified at 2022-09-11 18:59:48
Previous
Retrieve a post
Next
Delete a post bookmark
Built with