‎15-05-2020 09:19 AM - edited ‎15-05-2020 03:49 PM
HOPEX contains diagrams that have been designed or generated. Within the web front end you can see and download the diagrams as images. The REST API also provide the ability to export the diagram as a file.
3 format of files are supported : PNG, JPEG and SVG
You want to expose, as a read only, the diagrams of HOPEX into another application or an external website. This API is for download only, no updates on the diagram are allowed.
To perform this action there are 2 mains steps :
Depending on the use case you are in you may call the endpoint in a synchronous or asynchronous way. Refer to https://community.mega.com/t5/REST-API/Asynchronous-versus-Synchronous-Web-service-call/m-p/21913#M6 for more details on how to call the API in asynchronous way.
Please note that the API respect confidentiality. If the diagram you try to access is confidential with the credential you used you won't be able to get the image.
To get your diagram as an image follow the two steps :
Execute a GraphQL query on the endpoint of your choice {{server_url}}/HOPEXGraphQL/api/{{schemaName}} :
Query | Result |
|
|
The download URL are like this :
{{server_url}}/hopexgraphql/api/diagram/{{diagramId}}/image
where {{diagramId}} represent the absolute identifier of the object in HOPEX. They must be called with GET verb.
Examples with GraphiQL and Postman :
When you call the download URL the header should contains, in addition to default headers :
As a result of the call the body will contains the picture of the diagram.
Example with Postman :
Example of error message :
{
"Message": "An error has occurred.",
"ExceptionMessage": "Empty Object Invocation:Only default and GetID methods are available on a Empty Object",
"ExceptionType": "System.Exception",
"StackTrace": null
}