dokNet.dk API


    Code example


    Send SMS til respondent

    Du inviterer en respondent til at besvare undersøgelsen via mail på https://doknet.dk/api/respondent/sendmail/{fid}/{sid}

    Eksempel ved hjælp af PHP og curl

    <?php
        // The authorization token
        $authorization = "Authorization: Bearer <token>";
     
        // Parameters
        $fid = '<fid>';
        $sid = '<sid>';
     
        // Setup cURL
        $ch = curl_init('https://doknet.dk/api/respondent/sendsms/' . $fid . '/' . $sid);
        curl_setopt_array($ch, array(
          CURLOPT_POST => TRUE,
          CURLOPT_RETURNTRANSFER => TRUE,
          CURLOPT_SSL_VERIFYPEER => false,
          CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', $authorization ),
        ));
     
        // Send the request
        $response = curl_exec($ch);
     
        // Check for errors
        if($response === FALSE){
          die(curl_error($ch));
        }
     
        // Print the data from the response
        echo $response . PHP_EOL;
    ?>