API Questions on Kentico API.
Version 6.x > API > Updating Order via REST View modes: 
User avatar
Member
Member
justinb-countrysidegreenhouse - 7/20/2012 2:42:57 PM
   
Updating Order via REST
I've been trying to get this working for hours now but can't figure it out.

What I want to do is, via REST, change the status of an Order object from '2' to '9'. Actually, I'd just like to be able to change anything on an Order at this point. Nothing appears to be working.

I've tried submitting the following through the REST Test interface:

<data>
<COM_Order>
<OrderNote>9</OrderNote>
</COM_Order>
</data>


The URL it was submitted to: /rest/ecommerce.order/547

If I do a GET on that URL I receive:

<data><COM_Order>
<OrderID>547</OrderID>
...<snip>...
<OrderStatusID>2</OrderStatusID>
<OrderCurrencyID>1</OrderCurrencyID>
<OrderCustomerID>3</OrderCustomerID>
<OrderCreatedByUserID>53</OrderCreatedByUserID>
<OrderNote>Test</OrderNote>
...<snip>...


I cut out some of the fields to keep it short.

I thought I had everything done right according to the specs. Aside from using the REST Testing UI I also cooked up a way to submit them via the command line in Linux. That's not working either, but it does allow me to view all of the HTTP headers.

The request headers:

PUT /rest/ecommerce.order/547?format=xml HTTP/1.1
Authorization: Basic [REDACTED]
User-Agent: curl/7.21.0 (i486-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
Host: [REDACTED]
Accept: */*
Content-Type: text/xml
Content-Length: 67
Expect: 100-continue


And then I get a 100 continue and HTTP 200 OK message back from IIS.

I've tried some other stuff too. PUTting to a URL of /rest/ecommerece.order/<order guid>

I have tried ?format=xml on the URL, tried with it off, also tried JSON but that didn't fly either.

I've tried keeping the OrderID in the XML package too. I've also tried the GUID.

At one point McBeev and I fired up SQL profiler just to see if it was doing ANYTHING on the server and couldn't detect any action.

Software version is v6.0.4323.

If anybody has an idea I'm all ears.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 7/23/2012 4:08:04 AM
   
RE:Updating Order via REST
Hello,


There should be the OrderId, not OrderGUID. However, please check the settings in:

Site manager -> Settings -> Site: your site -> Integration -> REST

Especially, if the objects are not read only.

Can you access (read) the properties by REST correctly?


Best regards,
Helena Grulichova

User avatar
Member
Member
justinb-countrysidegreenhouse - 7/23/2012 1:51:10 PM
   
RE:Updating Order via REST
I've checked that the objects aren't set to read only, and I am able to read the objects via REST.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 7/24/2012 5:26:58 AM
   
RE:Updating Order via REST
Hello,


I tested your scenario and it updates the order note correctly by the PUT request with body which you mentioned.

Using Fiddler, what is the result of the PUT request?

Do you use Basic authentication in Site manager -> Settings -> Integration -> REST?

Can you please apply the latest hotfix?

Do you check the data directly in the database? (The application can use cache.)


Best regards,
Helena Grulichova

User avatar
Member
Member
justinb-countrysidegreenhouse - 7/25/2012 11:57:52 AM
   
RE:Updating Order via REST
An HTTP trace shows a response of 200 with 0 content length.

It's using Basic Authentication in the REST settings.

Today I applied hotfix 40 (one away from the latest, and the latest doesn't mention REST).

And we checked directly in the database.

No idea. I had our provider put in a ticket with the support team. Not sure what we're doing wrong.

Thanks for the second set of eyeballs.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 7/28/2012 3:27:45 AM
   
RE:Updating Order via REST
Hello,


I think you mean ticket 255305 which seems to be solved now. If you have any questions, feel free to ask.


Best regards,
Helena Grulichova