X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   General questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=66)
-   -   How to get complete order information via REST API (https://forum.x-cart.com/showthread.php?t=76369)

QuickBooksDev 06-27-2018 03:29 AM

How to get complete order information via REST API
 
We are trying to use the V5.3.3.3 version of the REST API to get orders on V5.3.5.3 XCart to import into QuickBooks.

We are not finding the API documentation to be of much help.

We would like to be able to get all the information in 1 call which should include complete customer info (i.e.adresses, phone numbers, etc) and all items. But so far have only been able to get general info.

All other attempts to do anything else gets a
Unable to connect to the remote server No connection could be made because the target machine actively refused it

This URL is the only one that works but does not provide complete order info (i.e. with items and customer info).
"https://clientdomain.com/admin.php?target=RESTPAI&_key=" & APIKey & "&path=order"

Using &_path fails same error
Using &path=orderitems fails same error

Please advise on how we can get complete orders from the rest api.

Thanks

tony_sologubov 06-29-2018 04:06 AM

Re: How to get complete order information via REST API
 
Hi @QuickBooksDev,

Did you try to use schema=complex in REST API request:
https://devs.x-cart.com/rest-api/#what-data-i-can-pull

Essentially, try to run the same request with _path=order, but add &_schema=complex bit to it and you will see whether the data returned is sufficient enough for your task.

Tony

Quote:

Originally Posted by QuickBooksDev
We are trying to use the V5.3.3.3 version of the REST API to get orders on V5.3.5.3 XCart to import into QuickBooks.

We are not finding the API documentation to be of much help.

We would like to be able to get all the information in 1 call which should include complete customer info (i.e.adresses, phone numbers, etc) and all items. But so far have only been able to get general info.

All other attempts to do anything else gets a
Unable to connect to the remote server No connection could be made because the target machine actively refused it

This URL is the only one that works but does not provide complete order info (i.e. with items and customer info).
"https://clientdomain.com/admin.php?target=RESTPAI&_key=" & APIKey & "&path=order"

Using &_path fails same error
Using &path=orderitems fails same error

Please advise on how we can get complete orders from the rest api.

Thanks


QuickBooksDev 06-29-2018 04:18 AM

Re: How to get complete order information via REST API
 
Thanks for replying. I have looked at that web page but it is not clear how to do a orders complex schema. What should be in the URL? I have tried &schema=complex and & "&_schema=complex" but always get 'unable to connect ...'.

What is the correct URL format? I am use VB.Net not php so there may be things that I don't understand looking at the php.

tony_sologubov 06-29-2018 04:25 AM

Re: How to get complete order information via REST API
 
Quote:

Originally Posted by QuickBooksDev
Thanks for replying. I have looked at that web page but it is not clear how to do a orders complex schema. What should be in the URL? I have tried &schema=complex and & "&_schema=complex" but always get 'unable to connect ...'.

What is the correct URL format? I am use VB.Net not php so there may be things that I don't understand looking at the php.


'&_schema=complex' should be in the URL. Did you try to open the URL in browser? Does it display anything?

I am thinking maybe this problem is somewhat related to VB.Net making requests, not to X-Cart directly.

Tony

QuickBooksDev 06-29-2018 05:31 AM

Re: How to get complete order information via REST API
 
Yes, I get the error
The site can't be reached.
nnnn refunded to connect.

Can you please give me the exact URL parameters to use?

tony_sologubov 06-29-2018 05:35 AM

Re: How to get complete order information via REST API
 
Quote:

Originally Posted by QuickBooksDev
Yes, I get the error
The site can't be reached.
nnnn refunded to connect.

Can you please give me the exact URL parameters to use?


It should be something like:
Code:

http://xcart.localhost/admin.php?target=RESTAPI&_key=yourkey&_path=order&_schema=complex

What if you try to run request like this:
Code:

http://xcart.localhost/admin.php?target=RESTAPI&_key=yourkey&_path=order/1&_schema=complex

where 1 is ID of some order. Does it fire the same error?

Tony

QuickBooksDev 06-29-2018 08:45 AM

Re: How to get complete order information via REST API
 
That seem to do the trick. Not sure why it didn't work before but this URL worked.

http://nnn.nnn.nnn.nn/admin.php?target=RESTAPI&_key=kkkkk&_path=order&_s chema=complex

Thanks!!!!

tony_sologubov 07-02-2018 02:01 AM

Re: How to get complete order information via REST API
 
Quote:

Originally Posted by QuickBooksDev
That seem to do the trick. Not sure why it didn't work before but this URL worked.

http://nnn.nnn.nnn.nn/admin.php?target=RESTAPI&_key=kkkkk&_path=order&_s chema=complex

Thanks!!!!


Happy to hear, everything is working now!

Let me know if there are any other questions.

Tony

Dongan 08-25-2018 07:44 PM

Re: How to get complete order information via REST API
 
Hi Tony,

Do we have APIs for placing an order? We need two APIs

1) Get all available shipping methods & cost based on the address
2) Order placement (Inputs: Customer address, payment method, shipping methods selected)

gior_08 11-08-2018 10:33 PM

Re: How to get complete order information via REST API
 
Hello,

following the help provided here https://devs.x-cart.com/rest-api/examples.html#changing-the-shipping-status-for-an-order, does anybody know if I change the shipping status (or the payment status) for an order the customer will get an email from the eshop?

I tested and I did not got an email and I was thinking if I make something wrong.

tony_sologubov 11-08-2018 10:54 PM

Re: How to get complete order information via REST API
 
Hi gior_08,

Quote:

Originally Posted by gior_08
following the help provided here https://devs.x-cart.com/rest-api/examples.html#changing-the-shipping-status-for-an-order, does anybody know if I change the shipping status (or the payment status) for an order the customer will get an email from the eshop?

I tested and I did not got an email and I was thinking if I make something wrong.


The notification sending routine is not triggered upon changing order's status via REST API.

You can create your own controller, which will send notification about order changing status.

The following articles might be helpful to you:
https://devs.x-cart.com/basics/controller_class.html
https://devs.x-cart.com/changing_store_logic/creating_custom_email_notifications.html (you can see an example of how to trigger sending email notification routine here)

Tony

gior_08 11-09-2018 02:38 AM

Re: How to get complete order information via REST API
 
Thanks a lot Tony.

By the way the REST API is a great tool to manage the data remote.
It has helped me a lot in interfacing with an external accounting program.

Just perfect !!!

tony_sologubov 11-09-2018 02:41 AM

Re: How to get complete order information via REST API
 
Thank you a lot, @gior_08!
Such kindest words mean a lot to us!

Tony

siddharth.puri@wheelandba 06-15-2020 05:54 PM

Re: How to get complete order information via REST API
 
Hi,

I was following this thread and it is really helpful. I was able to retrieve a lot of order data.

However, I am stuck with one thing. I am wondering, if I am able to pull out the price for a specific membership for the variant in the order.

Let's say the product has variants and each variant has price specified for different memberships.

I want to retrieve the price for a specific membership for the variant in the order.

Thanks and Regards,
Sid


All times are GMT -8. The time now is 03:40 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.