json 从API订购spree示例响应

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了json 从API订购spree示例响应相关的知识,希望对你有一定的参考价值。

{
  "id": 14,
  "number": "R824792894",
  "item_total": "24.45",
  "total": "44.45",
  "ship_total": "20.0",
  "state": "complete",
  "adjustment_total": "0.0",
  "user_id": 14,
  "created_at": "2017-03-08T21:59:32.383Z",
  "updated_at": "2017-03-08T22:05:19.671Z",
  "completed_at": "2017-03-08T22:00:54.487Z",
  "payment_total": "44.45",
  "shipment_state": "shipped",
  "payment_state": "paid",
  "email": "ismael.marin+test5@gmail.com",
  "special_instructions": null,
  "channel": "spree",
  "included_tax_total": "0.0",
  "additional_tax_total": "0.0",
  "display_included_tax_total": "ر.س0.00",
  "display_additional_tax_total": "ر.س0.00",
  "tax_total": "0.0",
  "currency": "SAR",
  "covered_by_store_credit": false,
  "display_total_applicable_store_credit": "ر.س0.00",
  "order_total_after_store_credit": "44.45",
  "display_order_total_after_store_credit": "ر.س44.45",
  "total_applicable_store_credit": "0.0",
  "display_total_available_store_credit": "ر.س0.00",
  "display_store_credit_remaining_after_capture": "ر.س0.00",
  "canceler_id": null,
  "display_item_total": "ر.س24.45",
  "total_quantity": 2,
  "display_total": "ر.س44.45",
  "display_ship_total": "ر.س20.00",
  "display_tax_total": "ر.س0.00",
  "token": "U4_K6RSTq7MWWqTfLY2sFw",
  "checkout_steps": [
    "address",
    "delivery",
    "payment",
    "confirm",
    "complete"
  ],
  "payment_methods": [
    {
      "id": 2,
      "name": "Pay on delivery",
      "method_type": "check"
    }
  ],
  "bill_address": {
    "id": 6,
    "firstname": "Ish",
    "lastname": "Ma",
    "full_name": "Ish Ma",
    "address1": "Hah haha 12",
    "address2": "",
    "city": "Khan",
    "zipcode": "90210",
    "phone": "4777929000",
    "company": null,
    "alternative_phone": null,
    "country_id": 1,
    "state_id": 14,
    "state_name": null,
    "state_text": "JED",
    "country": {
      "id": 1,
      "iso_name": "SAUDI ARABIA",
      "iso": "SA",
      "iso3": "SAU",
      "name": "Saudi Arabia",
      "numcode": 682
    },
    "state": {
      "id": 14,
      "name": "Jeddah",
      "abbr": "JED",
      "country_id": 1
    }
  },
  "ship_address": {
    "id": 6,
    "firstname": "Ish",
    "lastname": "Ma",
    "full_name": "Ish Ma",
    "address1": "Hah haha 12",
    "address2": "",
    "city": "Khan",
    "zipcode": "90210",
    "phone": "4777929000",
    "company": null,
    "alternative_phone": null,
    "country_id": 1,
    "state_id": 14,
    "state_name": null,
    "state_text": "JED",
    "country": {
      "id": 1,
      "iso_name": "SAUDI ARABIA",
      "iso": "SA",
      "iso3": "SAU",
      "name": "Saudi Arabia",
      "numcode": 682
    },
    "state": {
      "id": 14,
      "name": "Jeddah",
      "abbr": "JED",
      "country_id": 1
    }
  },
  "line_items": [
    {
      "id": 20,
      "quantity": 1,
      "price": "6.95",
      "variant_id": 44,
      "variant": {
        "product_id": 44,
        "id": 44,
        "name": "ABU WALAD - CHEDDAR CHEESE (200G)",
        "sku": "9164945",
        "price": "6.95",
        "weight": "0.3",
        "height": null,
        "width": null,
        "depth": null,
        "is_master": true,
        "slug": "abu-walad-cheddar-cheese-200g",
        "description": "ABU WALAD CHEDDAR 200G",
        "track_inventory": true,
        "option_values": [],
        "images": [
          {
            "id": 2,
            "position": 1,
            "attachment_content_type": "image/jpeg",
            "attachment_file_name": "IMG_2633.jpg",
            "type": "Spree::Image",
            "attachment_updated_at": "2017-03-06T23:37:57.697Z",
            "attachment_width": 1200,
            "attachment_height": 1200,
            "alt": "",
            "viewable_type": "Spree::Variant",
            "viewable_id": 44,
            "mini_url": "https://danube-solidus-staging.s3.amazonaws.com/spree/images/attachments/000/000/002/mini/IMG_2633.jpg?1488843477",
            "small_url": "https://danube-solidus-staging.s3.amazonaws.com/spree/images/attachments/000/000/002/small/IMG_2633.jpg?1488843477",
            "product_url": "https://danube-solidus-staging.s3.amazonaws.com/spree/images/attachments/000/000/002/product/IMG_2633.jpg?1488843477",
            "large_url": "https://danube-solidus-staging.s3.amazonaws.com/spree/images/attachments/000/000/002/large/IMG_2633.jpg?1488843477"
          }
        ],
        "display_price": "ر.س6.95",
        "options_text": "",
        "in_stock": false,
        "is_backorderable": true,
        "total_on_hand": -2,
        "is_destroyed": false
      },
      "adjustments": [],
      "single_display_amount": "ر.س6.95",
      "display_amount": "ر.س6.95",
      "total": "6.95"
    },
    {
      "id": 21,
      "quantity": 1,
      "price": "17.5",
      "variant_id": 93,
      "variant": {
        "product_id": 93,
        "id": 93,
        "name": "Air Wick Air Freshener Carpet Freshener Fresh Lemon 350g",
        "sku": "31455",
        "price": "17.5",
        "weight": "0.0",
        "height": null,
        "width": null,
        "depth": null,
        "is_master": true,
        "slug": "air-wick-air-freshener-carpet-freshener-fresh-lemon-350g",
        "description": "Simple, clever carpet deodoriser that has your carpets smelling beautifully fresh and clean in no time   Air Wick Carpet deodoriser has an innovative, dual-action formula that neutralises unpleasant odours fast and is the perfect finishing touch to your carpet cleaning regime.",
        "track_inventory": true,
        "option_values": [],
        "images": [],
        "display_price": "ر.س17.50",
        "options_text": "",
        "in_stock": false,
        "is_backorderable": true,
        "total_on_hand": -1,
        "is_destroyed": false
      },
      "adjustments": [],
      "single_display_amount": "ر.س17.50",
      "display_amount": "ر.س17.50",
      "total": "17.5"
    }
  ],
  "payments": [
    {
      "id": 4,
      "source_type": null,
      "source_id": null,
      "amount": "44.45",
      "display_amount": "ر.س44.45",
      "payment_method_id": 2,
      "state": "completed",
      "avs_response": null,
      "created_at": "2017-03-08T22:00:49.622Z",
      "updated_at": "2017-03-08T22:03:43.294Z",
      "payment_method": {
        "id": 2,
        "name": "Pay on delivery"
      },
      "source": null
    }
  ],
  "shipments": [
    {
      "id": 6,
      "tracking": null,
      "tracking_url": null,
      "number": "H34035667460",
      "cost": "20.0",
      "shipped_at": "2017-03-08T22:05:19.518Z",
      "state": "shipped",
      "shipping_rates": [
        {
          "id": 9,
          "name": "Store Pickup",
          "cost": "2.45",
          "selected": false,
          "shipping_method_id": 1,
          "shipping_method_code": "",
          "display_cost": "ر.س2.45"
        },
        {
          "id": 10,
          "name": "Home Delivery",
          "cost": "20.0",
          "selected": true,
          "shipping_method_id": 2,
          "shipping_method_code": "",
          "display_cost": "ر.س20.00"
        }
      ],
      "selected_shipping_rate": {
        "id": 10,
        "name": "Home Delivery",
        "cost": "20.0",
        "selected": true,
        "shipping_method_id": 2,
        "shipping_method_code": "",
        "display_cost": "ر.س20.00"
      },
      "shipping_methods": [
        {
          "id": 1,
          "code": "",
          "name": "Store Pickup",
          "zones": [
            {
              "id": 1,
              "name": "Domestic",
              "description": "Saudi Arabia shipping"
            }
          ],
          "shipping_categories": [
            {
              "id": 1,
              "name": "Default"
            }
          ]
        },
        {
          "id": 2,
          "code": "",
          "name": "Home Delivery",
          "zones": [
            {
              "id": 1,
              "name": "Domestic",
              "description": "Saudi Arabia shipping"
            }
          ],
          "shipping_categories": [
            {
              "id": 1,
              "name": "Default"
            }
          ]
        }
      ],
      "manifest": [
        {
          "variant_id": 44,
          "quantity": 1,
          "states": {
            "shipped": 1
          }
        },
        {
          "variant_id": 93,
          "quantity": 1,
          "states": {
            "shipped": 1
          }
        }
      ],
      "adjustments": [],
      "order_id": "R824792894",
      "stock_location_name": "default"
    }
  ],
  "adjustments": [],
  "credit_cards": [],
  "permissions": {
    "can_update": true
  }
}

以上是关于json 从API订购spree示例响应的主要内容,如果未能解决你的问题,请参考以下文章

json 这是data.usajobs.gov jobs API的示例空响应。

带有 Google PHP SDK 的 YouTube API - 以 JSON 格式响应

从API响应到PostgreSQL表

Ruby API响应视图:如何呈现JSON响应?

将来自 Json 响应的 HTML 标记渲染到模板文字

PHP curl获取api响应