Page 1 of 1

Should vicidial API use POST or GET

PostPosted: Mon Jul 04, 2022 9:51 am
by SPAMSAM
Relatively version agnostic question.

When using libraries line curl, wget, python to make API calls is the GET or POST method preferred?

Re: Should vicidial API use POST or GET

PostPosted: Mon Jul 04, 2022 1:09 pm
by mflorell
Either is fine as far as VICIdial is concerned. It's often easier to program as a GET, but using POST allows larger query strings and is more secure(if you are going outside of a local network).

Re: Should vicidial API use POST or GET

PostPosted: Tue Jul 05, 2022 4:37 pm
by williamconley
SPAMSAM wrote:Relatively version agnostic question.

When using libraries line curl, wget, python to make API calls is the GET or POST method preferred?


For a bit more depth: Example from the non-agent api:

Code: Select all
if (isset($_GET["caller_id_name"]))                             {$caller_id_name=$_GET["caller_id_name"];}
        elseif (isset($_POST["caller_id_name"]))        {$caller_id_name=$_POST["caller_id_name"];}


The system specifically checks for and captures GET first and POST second. Since using both is ... never done, either is fine.