Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How To Update Shipping Of An Order Via Api

 
  • JiriMatejka
  • Newbie
  • Trial users
  • Join Date: 27-Jan 20
  • 6 posts

Posted 27 January 2020 - 08:25 PM #1

Hi,

 

How can I update na existing order programatically via API?

 

As per https://docs.cs-cart...update-an-order

 

I submitted a JSON object like the one below to /orders/124 and the server returned 200 OK + valid JSON response. But the Shipping and Company attributes have not been updated. I ensured that the shipping of id 10 exists.

 

{

order_id: 124

shipping_id: "10",

company: "Some Company"

}

 

Also tried to remove the order_id or pass whole shipping object rather than just the ID, but none of this worked. Always got 200 OK, but the data has not changed.

 

What is the correct way of doing this?

 

Sorry for posting it to Documentation forum, but I don't have permission to submit to Developer's Corner.

 

thanks

 

Jiri



 
  • soft-solid
  • Junior Member
  • Authorized Reseller
  • Join Date: 19-Apr 10
  • 1015 posts

Posted 28 January 2020 - 04:37 PM #2

Hello JiriMatejka

 

{

order_id: 124

shipping_ids: "10",

company: "Some Company"

}

 

shipping_id -> shipping_ids

 

shipping_ids = 10 must exists. there must be a delivery with this id. It cannot be any number.

 

Best regards

Robert


Team of SoftSolid
cs-cart.pl, marketplace

We specialize in creating the highest quality addons, safe, useful and flexible


 
  • JiriMatejka
  • Newbie
  • Trial users
  • Join Date: 27-Jan 20
  • 6 posts

Posted 03 February 2020 - 08:37 PM #3

Thanks Robert for you answer.

 

Would you know how can I create a new shipment for an order?

 

I submitted a POST request to /api/shipments

 

{
    "carrier": "Fedex",
    "order_id": 126,
    "products": [
        {
            "1529601775": "1"
        }
    ],
    "shipping": "PA"
    "shipping_id": "8",
    "user_id": "4",
    "tracking_number": "FedexTrackingNr"
}

 

but am getting 500 Internal Server Error. If I make an intentional mistake, eg. broken JSON, then I get valid error message like this:

{
    "message""Bad Request: Syntax error, malformed JSON",
    "status"400
}

 

I ensured the order id, product item id, shipping and user exist. The carrier is a dummy string, is that OK?

 

Any idea how to resolve this?

 

thanks

 

Jiri



 
  • soft-solid
  • Junior Member
  • Authorized Reseller
  • Join Date: 19-Apr 10
  • 1015 posts

Posted 04 February 2020 - 02:33 PM #4

Hello

 

You miss the comma after "shipping": "PA"

 

Best regards

Robert


Team of SoftSolid
cs-cart.pl, marketplace

We specialize in creating the highest quality addons, safe, useful and flexible


 
  • JiriMatejka
  • Newbie
  • Trial users
  • Join Date: 27-Jan 20
  • 6 posts

Posted 04 February 2020 - 04:38 PM #5

Hello

 

You miss the comma after "shipping": "PA"

 

Best regards

Robert

 

Thanks. The missing comma is just a typo in this comment. I sent a valid request to /api including the missing comma. If i sent such a malformed JSON to api then I get Bad Request: Syntax error... message which is logical and expected. 

 

But If I send a valid (I believe it is valid) request, see below, then I get 500 Internal Server error. 

 

{
   "carrier":"Fedex",
   "order_id":126,
   "products":[
      {
         "1529601775":"1"
      }
   ],
   "shipping":"PA",
   "shipping_id":"8",
   "user_id":"4",
   "tracking_number":"FedexTrackingNr"
}


 
  • soft-solid
  • Junior Member
  • Authorized Reseller
  • Join Date: 19-Apr 10
  • 1015 posts

Posted 05 February 2020 - 10:56 AM #6

Hello

 

Please try this

 

{
   "carrier":"fedex",
   "order_id":126,
   "products":{"1529601775":"1"},
   "shipping":"PA",
   "shipping_id":"8",
   "user_id":"4",
   "tracking_number":"FedexTrackingNr"
}
 
Best regards
Robert

Team of SoftSolid
cs-cart.pl, marketplace

We specialize in creating the highest quality addons, safe, useful and flexible


 
  • JiriMatejka
  • Newbie
  • Trial users
  • Join Date: 27-Jan 20
  • 6 posts

Posted 05 February 2020 - 07:22 PM #7

 

Hello

 

Please try this

 

{
   "carrier":"fedex",
   "order_id":126,
   "products":{"1529601775":"1"},
   "shipping":"PA",
   "shipping_id":"8",
   "user_id":"4",
   "tracking_number":"FedexTrackingNr"
}
 
Best regards
Robert

 

 

Thanks, using fedex instead of FedEx worked.

 

Thanks for your help!

 

Jiri



 
  • JiriMatejka
  • Newbie
  • Trial users
  • Join Date: 27-Jan 20
  • 6 posts

Posted 05 February 2020 - 07:48 PM #8

Could you please advice how to create shipments for multiple products within one order? Do I have to create multiple shipping records?

 

thanks

 

Jiri



 
  • soft-solid
  • Junior Member
  • Authorized Reseller
  • Join Date: 19-Apr 10
  • 1015 posts

Posted 06 February 2020 - 11:39 AM #9

Hello

 

Please try:

 

{
    "carrier": "FedEx",
    "order_id": 15365,
    "products": {"3224993888":1,"3074339062":1},
    "shipping": "PA",
    "shipping_id": "8",
    "user_id": "1"
}
 
Best regards
Robert

Team of SoftSolid
cs-cart.pl, marketplace

We specialize in creating the highest quality addons, safe, useful and flexible


 
  • JiriMatejka
  • Newbie
  • Trial users
  • Join Date: 27-Jan 20
  • 6 posts

Posted 07 February 2020 - 08:03 PM #10

 

Hello

 

Please try:

 

{
    "carrier": "FedEx",
    "order_id": 15365,
    "products": {"3224993888":1,"3074339062":1},
    "shipping": "PA",
    "shipping_id": "8",
    "user_id": "1"
}
 
Best regards
Robert

 

 

Thanks, that worked. 



 
  • soft-solid
  • Junior Member
  • Authorized Reseller
  • Join Date: 19-Apr 10
  • 1015 posts

Posted 07 February 2020 - 08:07 PM #11

Hello

 

You are welcome :)

 

Best regards

Robert


Team of SoftSolid
cs-cart.pl, marketplace

We specialize in creating the highest quality addons, safe, useful and flexible