From draft to publication

Combine catalog lookup, photo uploads, resource versions and visibility checks in one integration.

On this page

1. Read the form rules

Fetch the listing types and matching catalogs. Keep the form version. Identify required and conditional fields and the minimum photo count for the chosen type.

curl --fail-with-body --request GET \
  --url "${MOTANO_API_ORIGIN}/api/v1/listing-types" \
  --header "Authorization: Bearer ${MOTANO_API_KEY}"

2. Create a draft and keep its ID

Create a draft with a unique Idempotency-Key. Map the Motano ID to your own record and keep the response ETag.

curl --fail-with-body --request POST \
  --url "${MOTANO_API_ORIGIN}/api/v1/listings/drafts" \
  --header "Authorization: Bearer ${MOTANO_API_KEY}" \
  --header "Idempotency-Key: ${MOTANO_IDEMPOTENCY_KEY}" \
  --header "Content-Type: application/json" \
  --dump-header - \
  --data '{
  "listingTypeValue": "osobowe"
}'

3. Wait for ready photos

Reserve a file, upload it with the reservation headers, complete the upload and check its status. Omit the Motano Bearer key when uploading to the signed URL. Attach only ready IDs to the listing.

curl --fail-with-body --request POST \
  --url "${MOTANO_API_ORIGIN}/api/v1/media" \
  --header "Authorization: Bearer ${MOTANO_API_KEY}" \
  --header "Content-Type: application/json" \
  --data '{
  "contentType": "image/jpeg",
  "sizeBytes": 124000,
  "category": "osobowe"
}'

4. Complete the draft and submit it

Complete the listing with the current ETag as If-Match and a new idempotency key. Use the returned ETag when submitting for publication. If the API returns paymentPath, send the owner to their signed-in Motano account.

curl --fail-with-body --request POST \
  --url "${MOTANO_API_ORIGIN}/api/v1/listings/${MOTANO_LISTING_ID}/publish" \
  --header "Authorization: Bearer ${MOTANO_API_KEY}" \
  --header "Idempotency-Key: ${MOTANO_IDEMPOTENCY_KEY}" \
  --header "If-Match: ${MOTANO_LISTING_ETAG}" \
  --header "Content-Type: application/json" \
  --dump-header - \
  --data '{
  "packageTier": "free"
}'

5. Synchronize visibility

Poll the detail endpoint at reasonable intervals. Show the status returned by the API. Display the public link once publicPath has a value and status and publicationState indicate visibility.

curl --fail-with-body --request GET \
  --url "${MOTANO_API_ORIGIN}/api/v1/listings/${MOTANO_LISTING_ID}" \
  --header "Authorization: Bearer ${MOTANO_API_KEY}" \
  --dump-header -