API de visualisation de document
  • 07 Dec 2023
  • 1 Minute à lire
  • Contributeurs
  • Sombre
    Clair
  • PDF

API de visualisation de document

  • Sombre
    Clair
  • PDF

Article Summary

Affichage d'un document a l'externe

Utilisation avec reverse-proxy
Dans le cadre où la fonctionnalité est utilisée avec un reverse-proxy, veuillez-vous assurer que le reverse-proxy alimente le header http X-Forwarded-Host.
Ceci fera en sorte que l'URL de signature générée sera faite à partir de l'URL du reverse-proxy et non l'URL interne du serveur Constellio.

Ceci peut être très utile pour exposer seulement cette URL à l'externe sans exposer votre serveur Constellio en entier sur le web.


Ce service web permet d'envoyer une requête au serveur afin d'obtenir un lien embed vers le visualisateur du document.


L'identification se fait par la mécanique de jeton de Constellio.


Les paramètres suivants peuvent être passés lors des appels:


ParamètreDescriptionStatut
recordId (Path Variable)L'identifiant du document.Obligatoire
expirationL'expiration en seconde de l'URL généréObligatoire
singleUseSi "true", l'URL générée ne pourra être utilisée qu'une seule fois.
Valeur par défaut "false".
Facultatif

Exemple

Appel

GET http://localhost:7070/constellio/rest/v2/documents/{recordId}/viewer?expiration=5000&singleUse=false


Réponse

http://localhost:7070/constellio?isExternalContentViewer=true&documentId=A01_numericContractWithDifferentCopy&signature=rO0ABXQA7DM2NGsvUnY2aFpJVjB4d3R2UjFRZTgzZS9aOVh3Z1NjeVMxcmM3VnNjNVNkK205UVc5ZTV6YmFrdjExeDZTdW1Yd2pOZmluTm9pU2pvVTBCS0RZR1Rxa3pYWGt4UFNZWU1SVS9TMDdkcnBJVGxKbEVHcWxYcDliV2ZnOVVMWFNMN2JLY2NOZFptREVBa2x4a001cVZqdjAveVR5ZCs4SmpzWXRUemdwOGpJbXVJbW1FcE1aaVRqb2d3U3ZJdVpkTEUway8rbGQvVk5ud2ZvSVhtVDhwY0Z5ME9CaTRkRUlrSnB5emwybzNMSDQ9

iFrame

Simplement créer un iFrame sur votre site avec comme source l'URL obtenue.

Exemple:

<!DOCTYPE html>
<html>
<body>

<h2>HTML Iframes</h2>
<p>You can use the height and width attributes to specify the size of the iframe:</p>

<iframe height="700" width="850" title="Iframe Example"
        src="http://localhost:7070/constellio?isExternalContentViewer=true&documentId=A01_numericContractWithDifferentCopy&signature=rO0ABXQA7DM2NGsvUnY2aFpJVjB4d3R2UjFRZTgzZS9aOVh3Z1NjeVMxcmM3VnNjNVNkK205UVc5ZTV6YmFrdjExeDZTdW1Yd2pOZmluTm9pU2pvVTBCS0RZR1Rxa3pYWGt4UFNZWU1SVS9TMDdkcnBJVGxKbEVHcWxYcDliV2ZnOVVMWFNMN2JLY2NOZFptREVBa2x4a001cVZqdjAveVR5ZCs4SmpzWXRUemdwOGpJbXVJbW1FcE1aaVRqb2d3U3ZJdVpkTEUway8rbGQvVk5ud2ZvSVhtVDhwY0Z5ME9CaTRkRUlrSnB5emwybzNMSDQ9"/>

</body>

</html>

Cet article vous a-t-il été utile ?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.