Skip to content

Sample Retail

Yuki Matsukura edited this page Aug 3, 2023 · 1 revision

小売向けサンプルコード

set host https://development.tanomimaster.com
set retail_token REPLACE_WITH_YOUR_TOKEN

curl -s -H "Authorization: Token $retail_token" "$host/api/v1/retail/shipping_addresses" | jq
curl -s -H "Authorization: Token $retail_token" "$host/api/v1/retail/shipping_addresses?retail_sales_office_code=c5775db149a374ceb3425b092c" | jq
curl -s -H "Authorization: Token $retail_token" "$host/api/v1/retail/shipping_addresses?retail_branch_code=4ca1222662167daede088b9d05" | jq

curl -s -H "Authorization: Token $retail_token" "$host/api/v1/retail/shipping_addresses/253c8717952e678106298b6625" | jq


curl -s -H "Authorization: Token $retail_token" "$host/api/v1/retail/retail_users" | jq



# 発注
set order_body "
{
  \"code\": \"$(random 1000000000 9999999999)\",
  \"makers\": [
    {
      \"maker_code\": \"maker_code\",
      \"retail_sales_office_code\": \"a32a0c942926de863083e3598c\",
      \"retail_user_code\": \"ftlkqvkkvs\",
      \"desired_delivery_date\": \"2023-08-10\",
      \"shipping_postcode\": \"1060031\",
      \"shipping_city\": \"city\",
      \"shipping_street_address\": \"street\",
      \"shipping_building\": \"building\",
      \"shipping_office_name\": \"office name\",
      \"shipping_tel\": \"03-0000-1111\",
      \"shipping_prefecture_code\": 1,
      \"products\": [
        {
          \"code\": \"qghdvhjabusntjmanslz\",
          \"branch_number\": 1,
          \"number_of_items\": 2,
          \"memo\": \"memo\"
        }
      ]
    }
  ]
}
"


curl -s -X POST \
  -H "Authorization: Token $retail_token" \
  -H "Content-Type: application/json" \
  -d $order_body \
  "$host/api/v1/retail/orders" | jq



# {
#   "id": "Z2lkOi8vdGFub21pbWFzdGVyLXd3dy9PcmRlci81Ng",
#   "retail_code": "q8hhznoda4",
#   "retail_id": 1,
#   "code": "4657226619",
#   "memo": null,
#   "created_at": "2023-08-04T01:39:34.384+09:00",
#   "updated_at": "2023-08-04T01:39:34.384+09:00",
#   "ordered_at": "2023-08-04T01:39:34.343+09:00",
#   "orders_makers": [
#     {
#       "id": "Z2lkOi8vdGFub21pbWFzdGVyLXd3dy9PcmRlcnNNYWtlci81Ng",
#       "retail_sales_office_code": "a32a0c942926de863083e3598c",
#       "retail_user_code": "ftlkqvkkvs",
#       "status": "ordered",
#       "maker_id": 1,
#       "maker_user_id": null,
#       "maker_sales_office_id": null,
#       "retail_user_id": 1,
#       "retail_sales_office_id": 1,
#       "code": "4657226619",
#       "created_at": "2023-08-04T01:39:34.390+09:00",
#       "updated_at": "2023-08-04T01:39:34.390+09:00",
#       "desired_delivery_date": "2023-08-10",
#       "maker_code": "maker_code",
#       "order_products": [
#         {
#           "id": "Z2lkOi8vdGFub21pbWFzdGVyLXd3dy9PcmRlclByb2R1Y3QvNjM",
#           "orders_maker_id": "Z2lkOi8vdGFub21pbWFzdGVyLXd3dy9PcmRlcnNNYWtlci81Ng",
#           "product_id": 1,
#           "gas_type_id": null,
#           "name": "輸出",
#           "code": "qghdvhjabusntjmanslz",
#           "branch_number": 1,
#           "internal_code": "",
#           "price_amount": null,
#           "price_currency": "JPY",
#           "maker_price_for_retail_amount": 947,
#           "maker_price_for_retail_currency": "JPY",
#           "subtotal_excluding_tax": 1894,
#           "use_gas_type_master": false,
#           "estimated_delivery_duration": 3,
#           "catalog_url": null,
#           "approved_drawing_url": null,
#           "shipping_postcode": "1060031",
#           "shipping_prefecture_code": 1,
#           "shipping_city": "city",
#           "shipping_street_address": "street",
#           "shipping_building": "building",
#           "shipping_office_name": "office name",
#           "shipping_tel": "03-0000-1111",
#           "delivery_date": null,
#           "number_of_items": 2,
#           "memo": "memo",
#           "order_status": "ordered",
#           "estimated_delivery_date": "2023-08-09",
#           "official_estimated_delivery_date": null,
#           "answered_at": null,
#           "order_confirmed_at": null,
#           "cancel_confirmed_at": null,
#           "created_at": "2023-08-04T01:39:34.397+09:00",
#           "updated_at": "2023-08-04T01:39:34.397+09:00",
#           "cancelled_at": null,
#           "shipping_slip_number": null,
#           "delivery_company_id": null,
#           "shipping_status": "undelivered"
#         }
#       ]
#     }
#   ]
# }



Clone this wiki locally