PUT (update) success code but no changes made

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cati
    Junior Blueparker
    • Jun 2014
    • 4

    #1

    PUT (update) success code but no changes made

    Hi,

    I'm working with the API for the first time, and though I've successfully manged to retrieve data, I'm struggling to update.
    I have an order which I'm trying to update by setting the custom_status to {"id" : 4} which corresponds to "Processing" in our system.
    The code I'm sending looks like this:

    {
    'status': '{"id":1}',
    'custom_status': '{"id":4}',
    'order_number': bundle.inputData.order_number,
    'do_process': 'true'
    }

    with the order_number being populated by the user, and is a valid order number.

    The response would seem to indicate that I've been successful:

    {
    "updated": 1,
    "unchanged": 0,
    "payments_failed": 0,
    "emails_sent": 0,
    "processed": 0,
    "payments_taken": 0

    }

    However, when I look back at the admin orders dashboard the order is unchanged.

    Can anyone advise?

    Thanks in advance

    Catalina
  • Bandanashop
    Senior Blueparker
    • Jun 2012
    • 236

    #2
    If you are doing it onscreen here (https://www.bluepark.co.uk/api-specification.html) then it will not update BUT will show you that it has done. This is by design.
    If you have wrote code and you are getting that response check that you really are doing a PUT and check the HTTP response code too.
    www.herniapants.com

    Comment

    • Bandanashop
      Senior Blueparker
      • Jun 2012
      • 236

      #3
      Here is some sample code taken from a live transaction that has worked today and not done through the https://www.bluepark.co.uk/api-specification.html interface.

      Try taking out the 'status': '{"id":1}', section of your code, that is not required and may be conflicting. You just need to tell the order number what the new custom status is...


      This is what works in my PUT call to the server (I don't want to finish processing or send emails so do_process is false.
      {
      "custom_status": {
      "name": "FTP Ready"
      },
      "do_process": false,
      "do_send_confirmation": false,
      "do_send_email": false,
      "order_number": "IN17181"
      }


      sending to https://www.yourdomainnamehere.com/api/v1/orders
      HTTP response is :200
      and here is the response...

      {
      "emails_sent": 0,
      "payments_failed": 0,
      "payments_taken": 0,
      "processed": 0,
      "unchanged": 0,
      "updated": 1

      The ability to change to a custom status that you can define is extremely useful. I hope this helps you....
      Rob
      www.herniapants.com

      Comment

      Working...