Extend a classified
Extends the duration of an active classified listing.
The resulting expiry date of the listing will be the current date and time plus the category-specific extension period, which is a number of days that depends on the category (for example 21 days for residential for sale and to rent, 84 days for new homes, 168 days for commercial property and 14 days for Motors and Flatmates Wanted; the period for a category is also returned as ExtensionPeriod by the category details API). This API is currently supported for classifieds in the following categories: Trade Me Property, Trade Me Motors and Businesses for Sale.
Authentication: requires an OAuth access token with the MyTradeMeWrite permission (the same permission for every category). The listing must belong to the authenticated member.
Which listings can be extended: only live classifieds. If no live listing exists with the ListingId the call fails with HTTP 400 and the message "Listing id {id} is not valid", and a live listing that is not a classified fails with HTTP 400 and "Only classified listings can be extended". The following return HTTP 200 with Success false: a listing owned by another member ("Member {member id} does not own listing"), a coming soon listing ("Coming soon listing cannot be extended"), and a category with no extension period ("Category {category name} is not yet supported by this method"), and a Motors car or bike listing with a bundle ("Car listing with a bundle cannot be extended. Please relist instead." or "Bike listing with a bundle cannot be extended. Please relist instead.").
Finding out why a call failed. Business-rule failures (for example a validation message, a listing you do not own, or a listing in the wrong state) are returned with HTTP 200 and a ListingResponse whose Success is false and whose Description holds the reason; check Success, not only the HTTP status. Several validation messages are joined with new lines in Description, and each is prefixed with the attribute name as "For {attribute name} : {message}" when the message relates to an attribute. A request that cannot be processed at all (for example malformed JSON, or an invalid listing ID) is returned with HTTP 400 and an error body containing Request (the URL called) and ErrorDescription (the message), and, for some errors, Error (with Code, UserDescription and DeveloperDescription) and an Errors list when there is more than one. A missing or insufficient OAuth token returns HTTP 401 with an ErrorDescription naming the permission required. Any unexpected server error returns HTTP 500 with a generic message.
| URL: | https://api.trademe.co.nz/v1/Selling/Extend.{file_format} |
|---|---|
| HTTP Method: | POST |
| Requires Authentication? | Yes |
| Permission Required: | MyTradeMeWrite: Maintain your watchlist, answer questions and post comments. |
| Supported Formats: | XML, JSON |
| Rate Limited? | Yes |
URL parameters
| file_format | Enumeration (required) | The format of the response. | ||||
|---|---|---|---|---|---|---|
|
||||||
POST Data
<ExtendClassifiedRequest>
| ListingId | Integer (required) |
The ID of the listing to withdraw, relist or extend. For a relist this is the ID of the closed listing, not of the new listing that the relist creates. Required. |
|---|---|---|
| ReturnListingDetails | Boolean (optional) |
Optional, default false. Set to true to have the full listing details returned in the Listing field of the response when the call succeeds. |
Returns
<ListingResponse>
A ListingResponse. When Success is true, ListingId is the same ID you supplied (an extension does not create a new listing) and Description states the new closing time. When Success is false, Description explains why and the listing was not extended.
| Success | Boolean |
Indicates whether the operation was successful. |
|
|---|---|---|---|
| Description | String or null |
The description of the error, if the operation failed. |
|
| ListingId | Integer |
The ID of the listing the call acted on. For a create or a relist this is the ID of the new listing; for an edit, extend or withdraw it is the listing you supplied. Omitted on some failures. |
|
| Listing | <ListedItemDetail> or null |
The state of the listing, after the listing operation has successfully completed. This field is only present if the ReturnListingDetails parameter is true and the operation was successful. This field will also be missing if there was an error retrieving the listing details. For more information on this field, see the documentation for the listing details API. |
|
| (This type is defined elsewhere) | |||