Create Orders - Shipping ID not picked up correctly

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bandanashop
    Senior Blueparker
    • Jun 2012
    • 236

    #1

    Create Orders - Shipping ID not picked up correctly

    Hi, I'm creating Orders using the http://www.yourcompanyname/api/v1/orders POST message. The order creates fine but I cant seem to specify a Shipment method on the create, only the update.

    For example in this interaction I want to use the RM 2nd Class Shipping Method which has an ID Object of 19. This is visible on the first row below...

    Payload pre JSON
    ****************
    {"do_append_to_email": false, "shipping_method": {"id": 19, "name": "Royal Mail 2nd Class Standard"}, "payment_method": {"value": "offline"}, "do_tracking_number": false, "email_address": "amazon@bandanashop.com", "do_send_email": false, "channel": {"order_number": "103-12345-67891", "id": 2}, "payment_type": "instant", "billing_address": {"first_name": "testfirstname", "last_name": "testlastname", "postcode": "EX66AD", "country_code": "GB", "title_id": 1, "address_line_2": "Billaddressline2", "town_city": "BillTown", "address_line_1": "Billaddressline1"}, "paid": true, "do_send_confirmation": false, "allow_contact": false, "placed_by": "Anazon 103-12345-67891", "order_date": "2014-03-24T00:00:00", "do_process": true, "delivery_address": {"first_name": "testfirstname", "last_name": "testlastname", "postcode": "EX66AD", "country_code": "GB", "title_id": 1, "address_line_2": "Deladdressline1", "town_city": "DeliveryTown", "address_line_1": "Deladdressline1"}, "paid_on": "2014-03-24T00:00:00", "custom_status": {"id": 19}, "products": [{"sku": 214, "weight": 0.16, "quantity": 1}], "payment_taken:": 0.0, "vat_rate": 0.0, "do_take_payment": false, "currency_code": "GBP"}


    HTTP response is :200
    {"created":1,"updated":0,"unchanged":0,"processed" :0,"emails_sent":0,"payments_taken":0,"payments_fa iled":0,"locations":["https:\/\/www.bandanashop.com\/api\/v1\/orders\/3419"]}


    The Order is created and everything is perfect except that I have a shipping method of 'Tracked Next Day' (ID Object 12) not what I specified. But if I just press the API CREATE again (Same details) BP finds that it already has it and just does an update as you might expect BUT it does update the shipping method to 2nd Class! When I look at the BP Shipping Manager screen I thought maybe it has picked some sort of default so I moved the sequence around and it still selects 'Tracked Next Day' no matter what I put in the message.

    Is there some API code for Shipping Method missing on Create but that exists on Update? or am I doing something wrong?
    Many thanks
    Rob
    www.herniapants.com
  • Rich
    Park Ranger
    • Aug 2007
    • 2518

    #2
    Please try testing with just the shipping method's ID, rather than the ID and the name. You have several shipping methods with the same name, only differentiated by a reference - just supply the ID and test that, and ID is all you need.
    Developer :: Bluepark

    Comment

    • Bandanashop
      Senior Blueparker
      • Jun 2012
      • 236

      #3
      Thanks for getting back so quick. I did try that but I have recreated it again without the name for consistency. This time I just send ID Object 19 in the JSON create. This creates Order #IN113420 but as you can see it still picks up 'Royal Mail Tracked Next Day' Shipping Method instead of 'Royal Mail 2nd Class Standard'.
      Rob

      Payload pre JSON
      ****************
      {"do_append_to_email": false, "shipping_method": {"id": 19}, "payment_method": {"value": "offline"}, "do_tracking_number": false, "email_address": "amazon@bandanashop.com", "do_send_email": false, "channel": {"order_number": "105-12345-67891", "id": 2}, "payment_type": "instant", "billing_address": {"first_name": "testfirstname", "last_name": "testlastname", "postcode": "EX66AD", "country_code": "GB", "title_id": 1, "address_line_2": "Billaddressline2", "town_city": "BillTown", "address_line_1": "Billaddressline1"}, "paid": true, "do_send_confirmation": false, "allow_contact": false, "placed_by": "Anazon 105-12345-67891", "order_date": "2014-03-24T00:00:00", "do_process": true, "delivery_address": {"first_name": "testfirstname", "last_name": "testlastname", "postcode": "EX66AD", "country_code": "GB", "title_id": 1, "address_line_2": "Deladdressline1", "town_city": "DeliveryTown", "address_line_1": "Deladdressline1"}, "paid_on": "2014-03-24T00:00:00", "custom_status": {"id": 19}, "products": [{"sku": 214, "weight": 0.16, "quantity": 1}], "payment_taken:": 0.0, "vat_rate": 0.0, "do_take_payment": false, "currency_code": "GBP"}


      sending to https://www.bandanashop.com/api/v1/orders
      HTTP response is :200
      {"created":1,"updated":0,"unchanged":0,"processed" :0,"emails_sent":0,"payments_taken":0,"payments_fa iled":0,"locations":["https:\/\/www.bandanashop.com\/api\/v1\/orders\/3420"]}
      www.herniapants.com

      Comment

      Working...