JSONADM API Relationship

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
matteovg7
Posts: 14
Joined: 12 Dec 2019, 16:13

JSONADM API Relationship

Post by matteovg7 » 12 Dec 2019, 16:21

Hi, I can't figure out how to manage the relationships using JSONADM API.

For example, if I want to add a text to an existing catalog item, how can I achieve that?
I am able to add the text but I can't understand how to relate them to the catalog item.

Thank you.

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

Re: JSONADM API Relationship

Post by aimeos » 13 Dec 2019, 14:45

We use the Jsonadm API mainly for fetching data and updating things like stocks. Managing relations between domains isn't implemented yet but we are also interested in adding this to the API. If you can create a PR, we will help you to get this done and merge it for sure :-)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

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

Re: JSONADM API Relationship

Post by aimeos » 13 Dec 2019, 14:53

The ai-client-jsonapi package contains an example how to manage releationships and properties:
https://github.com/aimeos/ai-client-jso ... i/Customer
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

matteovg7
Posts: 14
Joined: 12 Dec 2019, 16:13

Re: JSONADM API Relationship

Post by matteovg7 » 16 Dec 2019, 13:32

Ok, I studied the code and I saw that the saveRelationships method was already implemented, but the parameter "type" was missing in the $listItem array.

At the moment I solved the problem adding in my extension this line in this file at line 457: https://github.com/aimeos/ai-admin-json ... m/Base.php

Code: Select all

$listItem->setType( "default" );
I know that isn't a definitive solution but I'm very new to Aimeos, I hope that in the next future I'm able to fix this in a definitive manner.

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

Re: JSONADM API Relationship

Post by aimeos » 16 Dec 2019, 14:07

That should do the job :-)
Can you please create a pull request for your change?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

matteovg7
Posts: 14
Joined: 12 Dec 2019, 16:13

Re: JSONADM API Relationship

Post by matteovg7 » 16 Dec 2019, 15:10


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

Re: JSONADM API Relationship

Post by aimeos » 16 Dec 2019, 18:36

We've modified you PR a bit because you should still be able to pass the list type in a POST or PATCH request.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply