dokNet.dk API


    Code example


    Get token+links til direkte login.

    Du henter token og links på adressen https://doknet.dkapi/admin/token-authentication ved hjælp af brugernavn/password i en JSON string

    Nedenfor et eksempel på hvordan en token+links kan hentes ved hjælp af PHP og curl

    <?php
        // The data to send to the API in an array
        $postData =  array("username" => "<username>", "password" => "<password>");
        $data_string = json_encode($postData);
     
            // Setup cURL
        $ch = curl_init('https://doknet.dk/api/admin/token-authentication');
        curl_setopt_array($ch, array(
            CURLOPT_POST => TRUE,
            CURLOPT_RETURNTRANSFER => TRUE,
            CURLOPT_SSL_VERIFYPEER => false,
            CURLOPT_HTTPHEADER => array(
                'Content-Type: application/json'
            ),
            CURLOPT_POSTFIELDS => $data_string
        ));
     
        // Send the request
        $response = curl_exec($ch);
     
        // Check for errors
        if($response === FALSE){
            die(curl_error($ch));
        }
     
        // Print the date from the response
        echo $response;
    ?>