-
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 ?
Riduci
Di più
-
Messaggi: 5
-
Ringraziamenti ricevuti 0
-
-
05/12/2020 21:56 #3648
da 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 !)
Si prega Accedi a partecipare alla conversazione.
Riduci
Di più
-
Messaggi: 380
-
Ringraziamenti ricevuti 26
-
-
15/12/2020 09:17 #3653
da 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;
Si prega Accedi a partecipare alla conversazione.
Riduci
Di più
-
Messaggi: 5
-
Ringraziamenti ricevuti 0
-
-
Riduci
Di più
-
Messaggi: 5
-
Ringraziamenti ricevuti 0
-
-
23/12/2020 09:58 #3661
da 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
Si prega Accedi a partecipare alla conversazione.
-
home page
-
vtenext - Official Forum
-
vtenext CE
-
N to N API management not included in documentation ?
Tempo creazione pagina: 0.215 secondi