JsonAdm Problem

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
Wall0fDeath
Posts: 28
Joined: 30 Aug 2022, 13:56

JsonAdm Problem

Post by Wall0fDeath » 01 Sep 2023, 09:16

Php : 8.2
Os: Debian GNU/Linux 11 (Bullseye)
Aimeos 22.10.12
Laravel 9.37.0

Dear Aimeos Team,

I have a task to send data(product, price, stock) from cloud erp to the shop and I have to give back the orders and the products, customers etc.

I could make the login part, api tokens etc.
I changed middleware from web to web and api on jsonadm, so i can call it from Insomnia.
I gave permission for the api user to manage/search these resources (even like get-> order/base/product) on jsonadm calls.

If i want to get all orders, than it works fine. (get->admin/default/jsonadm/order)
If i call admin/default/jsonadm/order/base/product -> it works too.

BUT, what I want is to include these to the get order request. ( 1 request instead of many + afterwork with pairing them)

In your documentation for 22.10* Aimeos I saw:
1st: add it like get paramters at the end:
get->admin/default/jsonadm/order?include=product
get->admin/default/jsonadm/order?include='product'
get->admin/default/jsonadm/order?include=order/base/product
get->admin/default/jsonadm/order?include='order/base/product'
etc.

2nd: I've tried to put it into the json's "meta" section with no success

But none of them worked for me. I always get these empty:
...
},
"relationships": []
...
}
],
"included": []

My question is:

How should I make a request to get all of the orders with all of their relationships, like products, addresses etc?
If I can do it in the json body, or in the route may I ask for an example please?

Thanks in advance!
Have a nice day!

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: JsonAdm Problem

Post by aimeos » 01 Sep 2023, 10:28

The JSONAdm API is meant for internal use within the admin backend only and not for accessing it externally as that may have security implications.

To answer your question, this should do the job:

Code: Select all

admin/default/jsonadm/order?include=order/base,order/base/coupon,order/base/address,order/base/product,order/base/service
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
Wall0fDeath
Posts: 28
Joined: 30 Aug 2022, 13:56

Re: JsonAdm Problem

Post by Wall0fDeath » 04 Sep 2023, 09:21

Thank your for your answer! It works fine now. :))
If you don't recommend using jsonadm for rest api calls because of the security risks, than what would you recommend to use to manage products etc. from could erp?

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: JsonAdm Problem

Post by aimeos » 04 Sep 2023, 10:47

Exchanging files (XML or CSV) is the most effective and the most secure way of doing bulk updates
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply