I have followed the instructions in your ProjeQtor REST API Specifications document and can successfully interact with the REST Web Service using the GET method. However, when using the POST or PUT methods, I get the following error: "data' is not correctly encoded for method PUT. Request for correct API KEY". For the testing purposes, I'm using the exact PHP code for the POST request as per the spec document. I'm testing on Projeqtor version 6.2.5.
I have gone through the following debugging steps:
1. Confirmed the correct access username and password is specified for the user"projeqtor":
curl_setopt($curl, CURLOPT_USERPWD, "projeqtor:my_pwd" ) ;
Apache grants access with correct password. Test with wrong password results in access failure, with error message in Apache log file. I have set up the .htaccess file to point to the correct .htpasswd file location. .htpasswd contains the generated password for user "projeqtor".
2. Confirmed that the AES 256 encryption of the test data is working in the PHP file, using the API key for user "projeqtor" as shown in >> Environmental parameters >> Users >> user=projeqtor . I echo'd the encrypted $data to my browser to confirm its encrypted.
3. I have triple checked every digit of the API key to ensure it was correctly copied into the PHP file.
4. I have kept the data for encryption as simple as possible: $data = '{"id:"1", "name":"new name"}'
4. The response from curl_exec gives the error: "data' is not correctly encoded for method PUT. Request for correct API KEY".
I'm not a PHP programmer (I mostly use Python to execute restful API interfaces). I was hoping to use Projeqtor with a REST API that is purely specified in URL fromat, without the need for the user to get involved in the PHP server pages that underlies the URL call.
I'd appreciate if you could indicate any possible cause of the error.
regards,
Stephan
It seems the encrypt function works correct, but the decrypt function returns an empty string. I have disabled encryption-decryption for the moment whilst testing POST and PUT by sending the data un-encrypted and 'short-circuiting' decrpytion in the /projeqtor/api/index.php file as follows:
$dataEncoded = file_get_contents("php://input");
$data=$dataEncoded; //$data=AesCtr::decrypt($dataEncoded, $user->apiKey, Parameter::getGlobalParameter('aesKeyLength')); //DISABLED THE ENCRYPTION-DECRYPTION.
I can POST and PUT successfully, so my testing is not held back for the moment
I'm running PorjeQtOr on Ubuntu 16.04 with Bitnami LLAP. I will dig deeper into the AES 256 decrypt function in the next few days...
En poursuivant votre navigation, vous acceptez le dépôt de cookies tiers destinés au bon fonctionnement et à la sécurisation du site (gestion de session, reCaptcha) et à une analyse statistique anonymisée des accès sur notre site (Google Analytics). Si vous vous inscrivez, les informations que vous fournirez ne seront jamais divulguées à un tiers sous quelque forme que ce soit. En savoir plus
Cookies settings
×
Functional Cookies
Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.
Session
Please login to see yours activities!
Other cookies
Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.