You are not logged in.
Pages: 1
Hello guys, I'm working on a mobile app for GLPI I'm working on the Actions historical part of a ticket and I want to add the possibility to add a document :
I didn't figure out how to get the documents added to a ticket and how to post a document using API, mainly an Image.
Because when I'm using this endpoint to get the documents of the ticket (id:x):
http://server/glpi/apirest.php/ticket/x/document
I get this response
[
{
"id": 3,
"entities_id": 0,
"is_recursive": 0,
"name": "Document: Ticket - tt",
"filename": "compressor.png",
"filepath": "PNG/21/9873b49c8f9888f6e12ea1a24a206a9ba02b2e.PNG",
"documentcategories_id": 0,
"mime": "image/png",
"date_mod": "2023-01-11 19:37:27",
"comment": null,
"is_deleted": 0,
"link": null,
"users_id": 4,
"tickets_id": 210,
"sha1sum": "219873b49c8f9888f6e12ea1a24a206a9ba02b2e",
"is_blacklisted": 0,
"tag": "6ea43817-d985547e-63bf01e58f4620.10794953",
"date_creation": "2023-01-11 19:37:27",
"links": [
...
]
}
]
So my question is how can I get the actual document or in this case the image from this API response ?
And how can I POST an image for a specific ticket if I wanted to.
I appreciate any help smile
Offline
Hello, did you find a solution to your question?
Offline
Use "/front/document.send.php?docid=DOCUMENT_ID" where the URL is relative to your GLPI and replace DOCUMENT_ID with the ID of the document.
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Offline
Excellent, I had come across this solution but I didn't know if it would be correct to use it this way.
Offline
That is the correct way to use it.
In fact, in the next main version of GLPI (10.1), there will be another REST API which is less close to the code and more user friendly and it will return this link rather than the internal path since the internal filepath means nothing to anyone using the API.
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Offline
Pages: 1