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)
-   -   REST API Create new Category (https://forum.x-cart.com/showthread.php?t=76308)

rstubbe 06-07-2018 01:43 PM

REST API Create new Category
 
I am trying to add a category via the REST API, but every attempt seem to fail with an error 400 or a success, but then the consistency check fails.

What I do is the following:
POST http://localhost/xcart5/admin.php?target=RESTAPI&_key=mykey&_path=category /0
with data:
{"depth":0,"pos":0,"translations":[{"code":"nl","name":"ALBUM & LIJST"},{"code":"en","name":"ALBUM & LIJST"}]}

It will give me the Success but actually creates a second root causing the consistancy check to fail.

When I change the data to:
{"depth":0,"pos":0,"translations":[{"code":"nl","name":"ALBUM & LIJST"},{"code":"en","name":"ALBUM & LIJST"}],parent:{"ogMeta":"","useCustomOG":false,"demo":fa lse,"useClasses":"A","category_id":1,"lpos":1,"rpo s":4,"enabled":true,"show_title":false,"depth": -1,"pos":0,"root_category_look":"icons","metaDescTy pe":"A","xcPendingExport":false,"lastUsage":0}}

Basicly adding the parent it will give me an error 400 Input data is incorrect

I also tried with specifying rpos/lpos, but it keeps on failing.

Can someone give me a working example?

rstubbe 07-26-2018 06:03 AM

Re: REST API Create new Category
 
Basicly, the add Category API call us totally useless!


All times are GMT -8. The time now is 12:28 AM.

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