Sharetribe icon

Sharetribe

Allows interaction with the Sharetribe Integration API

Stock → Update Stock Quantity

AI-generated

Summary

Adjust or compare-and-set stock quantity for a listing

Inputs

  • mode — Adjust existing or compare and set
  • listingId (required) — ID of the listing to create stock adjustment for
  • simplify — Whether to return a simplified version of the response
  • stockFields — Which fields to return. Choose from the list, or specify IDs using an expression.
  • listingFields — Which listing fields to return. Choose from the list, or specify IDs using an expression.
  • userFields — Which listing author fields to return. Choose from the list, or specify IDs using an expression.
  • quantity (required) — Quantity to adjust stock by (positive to increase, negative to decrease). Cannot be 0.
  • hasNoStockDefined — Expected current stock quantity. Must match for the operation to succeed (atomic compare-and-set).
  • oldTotal — Expected current stock quantity. Must match for new quantity to be set.
  • newTotal (required) — New total stock quantity to set for the listing.

Output shape

a single stock adjustment record

Returns the updated stock object; if simplify is true only selected fields are included; otherwise full response. Errors are wrapped in an error envelope.

Examples

Example 1: Increase stock of a listing by 10 units

mode=adjustQuantity, listingId=550e8400-e29b-41d4-a716-446655440000, quantity=10, simplify=true

Example 2: Set stock to a specific value using compare-and-set

mode=compareAndSet, listingId=550e8400-e29b-41d4-a716-446655440000, oldTotal=8, newTotal=10, simplify=false

Example 3: Adjust stock downward by 3 units with simplified response

mode=adjustQuantity, listingId=550e8400-e29b-41d4-a716-446655440000, quantity=-3, simplify=true

Links

Discussion