im using the api and im trying to post a new ticket but i get this problem with APIKEY each time
"error":"invalid API query", "message":"'data' is not correctly encoded for method POST. Request for correct API KEY"
I get the APIKEY that im using from the user interface :
API key :
468603bfe3148716bc9d1adba2a11355
Send information to the user
Look at old format User Manual (PPT format), available on download page.
You'll find exemples for API.
yes im using it , GET work just fine i have this problem with POST and APIKEY for encruption
this is the error i get "Request for correct API KEY"
i get the api key that im using from the "environmental parameters" --> "users" is that the correct path ?
Yes, you must use The API Key of the user that connects through the API.
i did use it but i keep getting the same error
{"error":"invalid API query", "message":"'data' is not correctly encoded for method POST. Request for correct API KEY"}
is it possible that the problem with the data format not the apikey ?
Yes, it is possible that your json format is incorrect, this will generate this error message.
Thry with simple json data or for instance, try and request first for a given object (GET) to retreive template format.
the correct dictionary for posting:?
-1:{"identifier":"id", "items":[{"id":"1", "reference":"1-INC-1", "name":"slide", "idTicketType":"16"........"nameTargetComponentVersion":"", "result":""}] }
-2 its juste
{"id":"1", "reference":"1-INC-1", "name":"slide", "idTicketType":"16"........"nameTargetComponentVersion":"", "result":""}
Both should work.
(I just tested and it really seems that both work...)
NB : take care to correctly encode your data to avoid unexpected characters. For instance, have a look at htmlEncodeJson() in projeqtor code 😉
Here are two exemples that works with POST action :
{"identifier":"id", "items":[{"id":"1", "reference":"001-001-INC-1", "name":"OK I CHNAGED NAME", "idTicketType":"16", "nameTicketType":"Incident", "idProject":"2", "nameProject":"project one - maintenance", "externalReference":"", "idUrgency":"2", "nameUrgency":"Urgent", "creationDateTime":"2011-09-01 12:00:00", "idUser":"1", "nameUser":"admin", "idContact":"", "nameContact":"", "originType":"", "originId":"", "refName":"bug: it does not work DOES IT ?", "idTicket":"", "nameTicket":"", "idContext1":"", "nameContext1":"", "idContext2":"", "nameContext2":"", "idContext3":"", "nameContext3":"", "idProduct":"", "nameProduct":"", "idComponent":"", "nameComponent":"", "idOriginalProductVersion":"1", "nameOriginalProductVersion":"wa V1.0", "idOriginalComponentVersion":"", "nameOriginalComponentVersion":"", "description":"
test pmlouf", "idActivity":"", "nameActivity":"", "idStatus":"8", "nameStatus":"re-opened", "idResolution":"", "nameResolution":"", "idResource":"3", "nameResource":"project manager", "idCriticality":"1", "nameCriticality":"Low", "idPriority":"1", "namePriority":"Low priority", "initialDueDateTime":"2011-09-02 18:00:00", "actualDueDateTime":"2011-09-09 18:30:00", "plannedWork":"0.00000", "realWork":"0.00000", "leftWork":"0.00000", "handled":"0", "handledDateTime":"", "done":"0", "doneDateTime":"", "solved":"0", "idle":"0", "idleDateTime":"", "cancelled":"0", "idTargetProductVersion":"", "nameTargetProductVersion":"", "idTargetComponentVersion":"", "nameTargetComponentVersion":"", "result":"
dans leau"}] }
{"apiResult":"OK", "apiResultMessage":"Ticket #1 updated", "id":"1", "reference":"001-001-INC-1", "name":"OK I CHANGED AGAIN", "idTicketType":"16", "nameTicketType":"Incident", "idProject":"2", "nameProject":"project one - maintenance", "externalReference":"", "idUrgency":"2", "nameUrgency":"Urgent", "creationDateTime":"2011-09-01 12:00:00", "idUser":"1", "nameUser":"admin", "idContact":"", "nameContact":"", "originType":"", "originId":"", "refName":"OK I CHNAGED NAME", "idTicket":"", "nameTicket":"", "idContext1":"", "nameContext1":"", "idContext2":"", "nameContext2":"", "idContext3":"", "nameContext3":"", "idProduct":"", "nameProduct":"", "idComponent":"", "nameComponent":"", "idOriginalProductVersion":"1", "nameOriginalProductVersion":"wa V1.0", "idOriginalComponentVersion":"", "nameOriginalComponentVersion":"", "description":"
test pmlouf", "idActivity":"", "nameActivity":"", "idStatus":"8", "nameStatus":"re-opened", "idResolution":"", "nameResolution":"", "idResource":"3", "nameResource":"project manager", "idCriticality":"1", "nameCriticality":"Low", "idPriority":"1", "namePriority":"Low priority", "initialDueDateTime":"2011-09-02 18:00:00", "actualDueDateTime":"2011-09-09 18:30:00", "plannedWork":"0.00000", "realWork":"0.00000", "leftWork":"0.00000", "handled":"0", "handledDateTime":"", "done":"0", "doneDateTime":"", "solved":"0", "idle":"0", "idleDateTime":"", "cancelled":"0", "idTargetProductVersion":"", "nameTargetProductVersion":"", "idTargetComponentVersion":"", "nameTargetComponentVersion":"", "result":"
dans leau"}