You are not logged in.
Hello,
I'm trying to link a document to a ticket in Postman but i'm getting this error:
[
"ERROR_GLPI_ADD",
"Vous n'avez pas les droits requis pour réaliser cette action."
]
I'm able to create a ticket and a document with the same authentification token.
The user is super admin in GLPI.
What am I missing there ?
Thanks for your help
Offline
Hi,
HAve you an error when you add a document to entity or generally?
If true, I think thak your folder have not the right acls (755) or wrong owner.
Good luck
Have a nice day
Offline
Hello,
I am having the same issue.
Document is uploaded.
Here is how I am doing :
// Création du fichier (enregistrement dans Documents)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $uploadUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"session-token: $sessionToken",
"App-Token: $appToken"
));
$filePath = realpath($fileTmpName);$postFields = array(
'uploadManifest' => json_encode([
'input' => [
'name' => $fileName,
'documentcategories_id' => 5, // Set appropriate category ID
'tickets_id' => $ticketId // Attach to the newly created ticket
]
]),
'filename[0]' => new CURLFile($filePath, $fileType, $fileName)
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$uploadResponse = curl_exec($ch);
curl_close($ch);$documentId = json_decode($uploadResponse)->id;
// Création de la relation ticket / document
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $createUrl.'/'.$ticketId.'/Document_Item');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"session-token: $sessionToken",
"App-Token: $appToken",
"Content-Type: application/json"
));$associationData = json_encode([
'input' => [
'documents_id' => $documentId,
'itemtype' => 'Ticket',
'items_id' => $ticketId
]
]);
echo json_encode(['contenu attached' => $associationData]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $associationData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);echo json_encode(['Réponse attached' => $response]);
Getting ERROR_GLPI_ADD
Offline