ProjeQtOr free project management software - [SOLVED] API POST Issues - ProjeQtOr

Formations en Amérique du Nord

Une formation est organisée par un de nos partenaires à Montréal.

Pour de plus amples informations, ou pour vous inscrire, rendez-vous sur notre planning de formations.

 

[SOLVED] API POST Issues

More
07 Fév 2019 18:07 #1 by CarlC
Hi, i've read through the documentation for using the API and reading data is no problem, when i try and send something back is when i run into problems.
The documentation gives an example for POSTing data using PHP but i'm not a PHP expert and would preferably be doing this through cURL or PowerShell, but i'm having trouble authenticating with either a specified username:password or the encrypted API key using the phpAES tool.
Can you give any examples of using POST with the API key from the command line or any other examples i could use?
Thanks

Please Connexion or Create an account to join the conversation.

More
08 Fév 2019 11:31 #2 by CarlC
Replied by CarlC on topic [SOLVED] API POST Issues
Tested some other ways of trying to POST data but it's still failing and in the system logs it gives an error:
[V7.3.5] cause = count(): Parameter must be an array or an object that implements Countable

Please Connexion or Create an account to join the conversation.

More
08 Fév 2019 11:47 #3 by babynus
Replied by babynus on topic [SOLVED] API POST Issues
Can you please post complete error log ?

Babynus
Administrator of ProjeQtOr web site

Please Connexion or Create an account to join the conversation.

More
08 Fév 2019 11:53 #4 by CarlC
Replied by CarlC on topic [SOLVED] API POST Issues
Thanks for looking into this - i resolved the "countable" error in the api/index.php file but i still can't POST or PUT anything.
The error message i receive now is: error: invalid API query, message: ' ' is not a known object class

System log:
2019-02-08 11:19:29.566 ===== TRACE ===== NEW CONNECTED USER 'admin'
2019-02-08 11:26:56.204 ===== TRACE ===== API : mode=GET user=admin, id=1, profile=1
2019-02-08 11:27:42.281 ===== TRACE ===== API : mode=POST user=admin, id=1, profile=1
2019-02-08 11:27:42.283 ***** ERROR ***** [V7.3.5] ERROR *****
2019-02-08 11:27:42.283 ***** ERROR ***** [V7.3.5] on file 'C:\xampp\htdocs\api\index.php' at line (231)
2019-02-08 11:27:42.284 ***** ERROR ***** [V7.3.5] cause = count(): Parameter must be an array or an object that implements Countable
2019-02-08 11:27:53.307 ===== TRACE ===== API : mode=POST user=admin, id=1, profile=1
2019-02-08 11:27:53.308 ***** ERROR ***** [V7.3.5] ERROR *****
2019-02-08 11:27:53.308 ***** ERROR ***** [V7.3.5] on file 'C:\xampp\htdocs\api\index.php' at line (231)
2019-02-08 11:27:53.309 ***** ERROR ***** [V7.3.5] cause = count(): Parameter must be an array or an object that implements Countable
2019-02-08 11:28:51.582 ===== TRACE ===== API : mode=POST user=admin, id=1, profile=1
2019-02-08 11:28:51.583 ***** ERROR ***** [V7.3.5] ERROR *****
2019-02-08 11:28:51.584 ***** ERROR ***** [V7.3.5] on file 'C:\xampp\htdocs\api\index.php' at line (231)
2019-02-08 11:28:51.584 ***** ERROR ***** [V7.3.5] cause = count(): Parameter must be an array or an object that implements Countable
2019-02-08 11:35:20.502 ===== TRACE ===== API : mode=POST user=admin, id=1, profile=1
2019-02-08 11:35:20.503 ***** ERROR ***** [V7.3.5] ERROR *****
2019-02-08 11:35:20.504 ***** ERROR ***** [V7.3.5] on file 'C:\xampp\htdocs\api\index.php' at line (231)
2019-02-08 11:35:20.504 ***** ERROR ***** [V7.3.5] cause = count(): Parameter must be an array or an object that implements Countable
2019-02-08 11:43:47.062 ===== TRACE ===== API : mode=POST user=admin, id=1, profile=1
2019-02-08 11:44:48.395 ===== TRACE ===== API : mode=POST user=admin, id=1, profile=1
2019-02-08 11:45:05.462 ===== TRACE ===== API : mode=POST user=admin, id=1, profile=1
2019-02-08 11:45:15.687 ===== TRACE ===== API : mode=POST user=admin, id=1, profile=1


Apache Log:
[Fri Feb 08 10:16:56.924283 2019] [mpm_winnt:notice] [pid 13976:tid 740] AH00456: Apache Lounge VC15 Server built: Jul 11 2018 12:13:24
[Fri Feb 08 10:16:56.924283 2019] [core:notice] [pid 13976:tid 740] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Fri Feb 08 10:16:56.932326 2019] [mpm_winnt:notice] [pid 13976:tid 740] AH00418: Parent: Created child process 4340
[Fri Feb 08 10:16:57.450214 2019] [ssl:warn] [pid 4340:tid 692] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Feb 08 10:16:57.489689 2019] [ssl:warn] [pid 4340:tid 692] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Feb 08 10:16:57.520244 2019] [mpm_winnt:notice] [pid 4340:tid 692] AH00354: Child: Starting 150 worker threads.
[Fri Feb 08 10:20:47.519743 2019] [auth_basic:error] [pid 4340:tid 1960] [client ::1:58597] AH01618: user apidata not found: /api/UpdateID1.php
[Fri Feb 08 10:20:56.788060 2019] [auth_basic:error] [pid 4340:tid 1960] [client ::1:58603] AH01618: user apidata not found: /api/UpdateID1.php
[Fri Feb 08 10:34:41.066854 2019] [auth_basic:error] [pid 4340:tid 1960] [client ::1:58930] AH01618: user ProjeQtOr not found: /api/activity/all
[Fri Feb 08 10:35:04.244502 2019] [auth_basic:error] [pid 4340:tid 1980] [client ::1:58931] AH01618: user ProjeQtOr not found: /api/activity

Please Connexion or Create an account to join the conversation.

More
08 Fév 2019 15:29 #5 by babynus
Replied by babynus on topic [SOLVED] API POST Issues
Hi

Issue on file 'C:\xampp\htdocs\api\index.php' at line (231) is fixed
Fix is to replace line 88 in api/index.php from
if (count($split>1)) {
to
if (count($split)>0) {

NB if you fixed with
if (count($split)>1) {
it may generate the issue on non existing class

Babynus
Administrator of ProjeQtOr web site

Please Connexion or Create an account to join the conversation.

More
08 Fév 2019 15:40 #6 by CarlC
Replied by CarlC on topic [SOLVED] API POST Issues
Thanks, i've fixed that but it didn't make any difference - i still get the error: {"error":"invalid API query", "message":"'data' missing for method POST"}

I've tried passing the data through using every way i know of but it gives the same error every time, clearly something isn't right but i can't work out where or how.
When i try to use cURL with other API's it works fine but when i try and give data using "-d {json data}" the Projeqtor API says the data is missing.

Please Connexion or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.092 seconds