Forum

API method POST
 
Notifications
Retirer tout

API method POST

3 Posts
1 Utilisateurs
0 Reactions
1,356 Vu
(@caie_guens)
Posts: 10
Active Member
Début du sujet
 
[#9771]

Hi,
Iwant to add Tichet, projects, tasks with the API.
In the documentation, there is a POST example with API.
I don't know how to make it to do th rigth thing.
I test the API with POSTMAN, I can read all(Client, Product, Project,....)
I test the API with PHP, I can red / search all for my need.
But the POST, it's a mistery for me, it'like the APIKey is not the good for the user logged to the API.
Where I lost to make the rigth thing ?
HELP HELP, my SVN is  about 100 revisions and not work.
Thanks
Guénolé
I give you the code for test, if someone can tell me where is the mistake
the user 'apipro' have the same password in the projeqtor user database and in api/.htpasswd 


 
Posté : 10/03/2025 6:03 pm
(@caie_guens)
Posts: 10
Active Member
Début du sujet
 

Hi,
This is the response :
Données avant chiffrement : {"id":"1", "name":"name to be changed for Ticket 1"}

Données après chiffrement : GgPP01oNz2djy1AZa8ya+D5eh/dRCHflMFgaeT0iWSOUKXuO0ueTwOMY/kq+CqtvTE1Ky5ErBnWXZchnI+XZ/kU0Btvmpg==

Réponse décryptée : "{"id":"1", "name":"name to be changed for Ticket 1"}"
Json Payload : {"data":"GgPP01oNz2djy1AZa8ya+D5eh/dRCHflMFgaeT0iWSOUKXuO0ueTwOMY/kq+CqtvTE1Ky5ErBnWXZchnI+XZ/kU0Btvmpg=="}
* Trying 192.168.12.10:80...
* TCP_NODELAY set
* Connected to 192.168.12.10 (192.168.12.10) port 80 (#0)
* Server auth using Basic with user 'projapi'
> POST /projeqtor/api/Ticket HTTP/1.1
Host: 192.168.12.10
Authorization: Basic cHJvamFwaTpwcm9qYXBp
Accept: */*
Content-Type: application/json
Content-Length: 110

* upload completely sent off: 110 out of 110 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Mon, 10 Mar 2025 16:03:38 GMT
< Server: Apache/2.4.41 (Ubuntu)
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate
< Pragma: no-cache
< Set-Cookie: PHPSESSID=6ft69rvmlap7mj2trhtc796lge; path=/
< Transfer-Encoding: chunked
< Content-Type: application/json; charset=UTF-8
<
* Connection #0 to host 192.168.12.10 left intact
Réponse de l'API : {"error":"invalid API query", "message":""'data' is not correctly encoded for method POST. Request for correct API KEY""}

Helps thanks
I can do it in SQL but the is normaly more efficient.
Guenole


 
Posté : 10/03/2025 7:08 pm
(@caie_guens)
Posts: 10
Active Member
Début du sujet
 

HI,
Good job for me, it works !!!

I release a new api/index.php whitch work for my needs
The POST Method was not encrypted ( it works in a LAN and have no needs of security trasaction) and I wanted to see the rhe good result of API POST.
After, there are 2 or 3 modifications for adapt data.

Thanks for Projeqtor
I make planning of OF CEGID PMI (mssql) -> API PROJEQTOR
BI with
- Testing needs in stock, commands vérification, Tickets for command if not
- Plan to dispatch MP for OF, ticket for missing part
- Plan for product with tasks
- Report of non quality
- import time / COST from PMI
- and many little app which are on excel
and more that I don't know now

Guénolé Michel

 


 
Posté : 12/03/2025 11:49 am
Share:
Retour en haut