X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Rest API (https://forum.x-cart.com/showthread.php?t=73535)

jgm72183 02-07-2016 11:33 AM

Rest API
 
http://kb.x-cart.com/display/XDD/REST+API+documentation#RESTAPIdocumentation

Please do not reply with this link. It is worthless.
I am looking for some examples for other tables to use. Right now I am trying to add the image record to the items we can add.

I think anybody that has tried to use this API would really like to see some more examples than the 101 stuff on the documentation page. I am sure somebody has a full list of what this API can do....

George

qualiteam 02-07-2016 10:57 PM

Re: Rest API
 
You can use "data:image" protocol to embed the image to the API request.

Something like this:
Code:

function base64_encode_image ($filename=string, $filetype=string) {
  if ($filename) {
      $imgbinary = fread(fopen($filename, "r"), filesize($filename));
      return 'data:image/' . $filetype . ';base64,' . base64_encode($imgbinary);
  }
}
...
'image' => array(
  'path' => 'im123.png',
  'content' => base64_encode_image(filePath, 'png')
)
...


Quote:

I am sure somebody has a full list of what this API can do....

Unfortunately, it is impossible to create the full list of API commands and parameters as it depends on the installed modules.

Basically, REST API is a bridge between third-party applications and Doctrine repository classes added by X-Cart 5 and ready-made/custom modules. It allows you to run the insert and query methods of repository classes.

jgm72183 02-17-2016 09:15 AM

Re: Rest API
 
We are using raw URLs to add items to the cart.

Example
http://personal.x-cart.com/<site>/admin.php?target=RESTAPI&_key=<restkey>&_path=prod uct Will list items.

We need the path and maybe some field names for xc_product_images.
I have tried a few that would make sense but like most things with xcart they could not just make it the table name.


Thanks,
Jamie


All times are GMT -8. The time now is 06:30 AM.

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