رفتن به محتوا
چسبیتوسعه‌دهندگان
مرسوله‌ها

Ship a Shipment

شرح نقطه‌های پایانی در مرجع API به انگلیسی است؛ واژه‌ها و قالب‌ها همان است که در پاسخ‌ها می‌بینید.

نمونه‌ها نشانی محیط اصلی را دارند، اما «امتحان کنید» همان درخواست را فقط به محیط آزمایشی می‌فرستد. کلید محرمانه شما نه در این سایت ذخیره می‌شود و نه در گزارش‌های آن می‌آید.

POST
/v1/me/seller/shipments/{shipmentId}/ship

Ships a confirmed Shipment, recounting its delivery dates from today, and the Shipment's units leave its Offers' stock a moment later. The same call on a shipped Shipment with another trackingCode corrects it.

A nationwide Shipping Method needs a code: without one the answer is 422 INVALID_VALUES, trackingCode with TRACKING_CODE_REQUIRED. A code that can't be one is trackingCode with INVALID_TRACKING_CODE, and one that reads as a phone number, a national ID or a Sheba number, or as a link, with TRACKING_CODE_HAS_CONTACT or TRACKING_CODE_HAS_LINK, since the Buyer reads it. Repeating a step already made answers the Shipment unchanged; any other step its status doesn't allow is 409 SHIPMENT_NOT_IN_STATUS, with the status in details. A missing Shipment, another Seller's, or one of an Order not paid is 404 SHIPMENT_NOT_FOUND, with the shipmentId in details. The call needs a token of the chasbi realm whose Account holds the Seller power ORDERS: the owner, or a Seller Member with the role MANAGER or ORDERS; or an access token of the chasbi-partners realm for an API Key of the Seller with the role MANAGER or ORDERS. Any other token is refused with ACCESS_DENIED.

احراز هویت

oauth2
headerAuthorizationBearer <token>

An access token of the chasbi-partners realm, made by the client-credentials grant with an API Key's client id and secret in the Authorization: Basic header. It lives five minutes and comes with no refresh token: ask for a new one when it ends.

پارامترهای مسیر

shipmentId*string

The id of the Shipment.

قالبuuid

پارامترهای سرآیند

Idempotency-Key?string

Makes the call safe to repeat. Send a new key with every new request, such as a random UUID, as a Structured Field String (RFC 9651): 1 to 255 printable ASCII characters in double quotes, with \" and \\ escaped, as in "8e03978e-40d5-43e8-bc93-6894a57f9324". Chasbi keeps each key for 24 hours from the start of the request it runs, for the caller whose token sent it.

Within 24 hours, the same key with the same method, path, query and body, byte for byte, gets the first answer again, with its status, Location and body and the header Idempotent-Replayed: true, and the call isn't made a second time. A body serialized differently is another request. That holds for a refusal (4xx) too, so after a refusal, send a new key once you've changed anything; an answer of 500 or more isn't kept, so the request may be sent again with the same key. The same key with another request is 422 IDEMPOTENCY_KEY_REUSED. While the first request with the key is still being processed, the key is 409 IDEMPOTENCY_KEY_IN_USE; send the request again in a moment. If the first request hasn't answered 5 minutes after it started, it is taken as lost, and the same key runs the request again. A value that isn't such a string is 400 VALIDATION_FAILED, with TYPE_MISMATCH for Idempotency-Key. With the header, a JSON body over 1 MiB is 413 CONTENT_TOO_LARGE. Without the header, the call is made every time it is sent.

بدنه درخواست

application/json
  1. body

The Tracking Code a Shipment ships with.

trackingCode?string

The code the carrier gave: 1 to 50 printable Latin characters, in any digits, with at least one letter or digit. Required for a nationwide Shipping Method, optional for a same-city one.

طولlength <= 50

بدنه پاسخ

The Shipment as it now stands.

application/json
  1. response

One of a Seller's Shipments, with the recipient as its data window shows it.

cancellationPenalty?

What cancelling it would cost the Seller, while the Seller can still cancel it and a penalty would apply.

cancellationReason?string

Why it was cancelled, once it was: OUT_OF_STOCK, CANNOT_SHIP_TO_ADDRESS or PRICE_ENTERED_WRONGLY from its Seller, BUYER_REQUEST from an Operator, OTHER from either, or CONFIRMATION_DEADLINE_MISSED from the 72-hour sweep. A Buyer's own earlier Cancellation reads BUYER_REQUEST.

مقدار در"OUT_OF_STOCK""CANNOT_SHIP_TO_ADDRESS""PRICE_ENTERED_WRONGLY""BUYER_REQUEST""OTHER""CONFIRMATION_DEADLINE_MISSED""PAYMENT_REVERSED"
cancelledAt?string

When it was cancelled, once it was.

قالبdate-time
cancelledBy?string

Who cancelled it: the Seller, an Operator, or the confirmation deadline. BUYER marks a Cancellation its Buyer made before Buyers stopped cancelling; nothing records it any more.

مقدار در"BUYER""SELLER""OPERATOR""CONFIRMATION_DEADLINE"
cancelledByAccount?

Who of the Seller's team shipped the Shipment, once it was shipped after Seller Members arrived.

confirmBy?string

When the Seller must confirm by, once the Order is paid.

قالبdate-time
confirmedAt?string

When the Seller confirmed it, once it did.

قالبdate-time
confirmedByAccount?

Who of the Seller's team shipped the Shipment, once it was shipped after Seller Members arrived.

deliveredAt?string

When it was Delivered, once it was.

قالبdate-time
deliveryConfirmation?string

How it came to be Delivered: the Buyer confirmed, or seven days passed.

مقدار در"BY_BUYER""AFTER_SEVEN_DAYS"
deliveryFrom*string

The first day delivery may come, in Tehran.

قالبdate
deliveryTo*string

The last day delivery may come, in Tehran.

قالبdate
dispatchDay*string

The day it leaves, or left, in Tehran.

قالبdate
id*string

The id of the Shipment.

قالبuuid
itemsTotal*integer

The lines' total. In whole Rial.

قالبint64
lines*array<>

What the Shipment holds.

net*integer

What the Shipment owes its Seller: the lines' total and the shipping fee, less the lines' Commission and its VAT. The transfer fee comes off each Transfer, not here. In whole Rial.

قالبint64
orderNumber*integer

The number of its Order; people know a Shipment as this number and its position.

قالبint64
paidAt*string

When its Order was paid.

قالبdate-time
position*integer

Its position in the Order, from 1.

قالبint32
recipient*

The recipient, as the data window shows it.

shippedAt?string

When it shipped, once it did.

قالبdate-time
shippedByAccount?

Who of the Seller's team shipped the Shipment, once it was shipped after Seller Members arrived.

shipping*

The Shipping Method as ordered.

status*string

Where it stands.

مقدار در"AWAITING_PAYMENT""AWAITING_CONFIRMATION""CONFIRMED""SHIPPED""DELIVERED""CANCELLED""UNPAID"
trackingCode?string

The Tracking Code it shipped with, if any. It reads left to right.

نمونه درخواست
curl -X POST 'https://api.chasbi.com/v1/me/seller/shipments/497f6eca-6276-4993-bfeb-53cbbbba6f08/ship' \  -H 'Idempotency-Key: "8e03978e-40d5-43e8-bc93-6894a57f9324"' \  -H 'Content-Type: application/json' \  -d '{}'
نمونه پاسخ
{  "cancellationPenalty": {    "ifCancelledNow": {      "commission": 0,      "multiplier": 0,      "penalty": 0,      "total": 0,      "vat": 0    },    "ifConfirmationLapses": {      "commission": 0,      "multiplier": 0,      "penalty": 0,      "total": 0,      "vat": 0    }  },  "cancellationReason": "OUT_OF_STOCK",  "cancelledAt": "2019-08-24T14:15:22Z",  "cancelledBy": "BUYER",  "cancelledByAccount": {    "apiKey": true,    "name": "string",    "owner": true  },  "confirmBy": "2019-08-24T14:15:22Z",  "confirmedAt": "2019-08-24T14:15:22Z",  "confirmedByAccount": {    "apiKey": true,    "name": "string",    "owner": true  },  "deliveredAt": "2019-08-24T14:15:22Z",  "deliveryConfirmation": "BY_BUYER",  "deliveryFrom": "2019-08-24",  "deliveryTo": "2019-08-24",  "dispatchDay": "2019-08-24",  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "itemsTotal": 0,  "lines": [    {      "commission": 0,      "commissionVat": 0,      "lineTotal": 0,      "offerId": "42da58f8-9040-4cf5-98ce-bce9965cca0d",      "quantity": 0,      "unitPrice": 0,      "variant": {        "axisValues": [          {            "axis": {              "fa": "string"            },            "number": "string",            "option": {              "fa": "string"            },            "unit": {              "fa": "string"            }          }        ],        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",        "mainImageId": "cd398d71-4443-4270-9f21-bcc59332a255",        "productId": "dcd53ddb-8104-4e48-8cc0-5df1088c6113",        "productName": {          "fa": "string"        }      }    }  ],  "net": 0,  "orderNumber": 0,  "paidAt": "2019-08-24T14:15:22Z",  "position": 0,  "recipient": {    "addressLine": "string",    "city": "string",    "name": "string",    "phone": "string",    "plate": "string",    "postalCode": "string",    "province": "ALBORZ",    "shown": "FULL",    "unit": "string"  },  "shippedAt": "2019-08-24T14:15:22Z",  "shippedByAccount": {    "apiKey": true,    "name": "string",    "owner": true  },  "shipping": {    "fee": 0,    "maxDays": 0,    "minDays": 0,    "reach": "SAME_CITY",    "shippingMethodId": "ea3a5f49-4f0a-4467-bd32-114aa00d0649",    "shippingMethodTypeId": "97e0df88-c5cd-415e-bb88-913ad75eea3c",    "typeName": {      "fa": "string"    }  },  "status": "AWAITING_PAYMENT",  "trackingCode": "string"}