-
home page
-
vtenext - Official Forum
-
vtenext CE
-
N to N API management not included in documentation ?
N to N API management not included in documentation ?
Less
More
-
Posts: 5
-
Thank you received: 0
-
-
05 Dec 2020 21:56 #3648
by tonyb@mobunti.co.uk
Hi
I cant see anything in the docs about many to many CRUD actions in the API. Any guidance would be helpful. The queries are based on module names but with an N to N connection, there is obviously a pivot table linking the two modules
Tony (same person as UKTony - my account keeps disconnecting from the forum !)
Please Log in to join the conversation.
Less
More
-
Posts: 380
-
Thank you received: 26
-
-
15 Dec 2020 09:17 #3653
by dende
Hi Tony,
in VTENEXT 20.04 there is a "relate" rest api method to do what you need.
Here example:
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://my.vtenext.url/restapi/v1/vtews/relate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\"id\":\"3x27\",\"relatelist\":\"{\\\"id\\\":\\\"6x76\\\"}\"}",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"Authorization: Basic HERE_YOUR_AUTH"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Please Log in to join the conversation.
Less
More
-
Posts: 5
-
Thank you received: 0
-
-
Less
More
-
Posts: 5
-
Thank you received: 0
-
-
23 Dec 2020 09:58 #3661
by tonyb@mobunti.co.uk
Hi
That allows for the adding of a link, but how do I remove or enquire on the links ? I'm working on a tagging system so that each customer is tagged with particular properties so I can see which customers have made enquiries about particular services or which customers have taken advantage of certain offers etc. I'm just about to try the code above but realised that is only going to allow me to relate 2 module records together, not to say "which tags does this customer have?" or "delete this tag from this customer". I cant use the normal "select * from module where id = 'x' " because its the pivot table that I'm enquiring on, not the module itself.
Thanks in advance
Tony
Please Log in to join the conversation.
-
home page
-
vtenext - Official Forum
-
vtenext CE
-
N to N API management not included in documentation ?
Time to create page: 0.130 seconds