Skip to content

Listings

Read and write a single listing.

  • Base URL: /wp-json/dms/v1/
  • All requests require a Bearer API key - see Authentication.

Endpoints

Method Path Capability Purpose
GET listing/{listing_id} - A single listing.
POST listing/{type_id} add_inventory Create a listing. Here {id} is the type ID.
PATCH listing/{listing_id} edit_all_inventory Update a listing (only supplied fields change).
DELETE listing/{listing_id} delete_inventory Trash a listing.

Note the {id} meaning: for GET / PATCH / DELETE it is the listing ID; for POST (create) it is the type ID the new listing belongs to.

All four return the listing payload on success (except DELETE, which returns the trashed id).

Writable fields

POST and PATCH accept:

Field Type Notes
title string
content string Description.
price number
status string publish or draft (anything else is treated as draft).
sold bool Mark sold / unsold.
sale_pending bool Mark sale pending.
categories object { category_id: value } - value is a string or array per category type.
images array [ { id, title, alt, category } ] - id is a media attachment ID.

On PATCH, only the fields you send are changed.

GET /listing/{listing_id}

curl "https://your-site.com/wp-json/dms/v1/listing/123" \
  -H "Authorization: Bearer YOUR_KEY"

Responds 404 dms_listing_not_found for an unknown ID.

POST /listing/{type_id}

Capability: add_inventory. {id} is the type ID. Returns 201 with the new listing.

curl -X POST "https://your-site.com/wp-json/dms/v1/listing/4" \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
        "title": "2021 Example Model",
        "content": "One owner, clean history.",
        "price": 24995,
        "status": "publish",
        "categories": { "42": "Blue" }
      }'

PATCH /listing/{listing_id}

Capability: edit_all_inventory. Send only the fields to change.

curl -X PATCH "https://your-site.com/wp-json/dms/v1/listing/123" \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "price": 22995 }'

DELETE /listing/{listing_id}

Capability: delete_inventory. Trashes the listing (recoverable from the WP trash; permanent removal via clear_trash).

curl -X DELETE "https://your-site.com/wp-json/dms/v1/listing/123" \
  -H "Authorization: Bearer YOUR_KEY"

See also