N to N API management not included in documentation ?

Di più
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.

Di più
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;
Ringraziano per il messaggio: tonyb@mobunti.co.uk

Si prega Accedi a partecipare alla conversazione.

Di più
18/12/2020 11:27 #3658 da tonyb@mobunti.co.uk
Thanks very much @dende

Si prega Accedi a partecipare alla conversazione.

Di più
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.

Tempo creazione pagina: 0.215 secondi