Any help returning temporary short URLs for the graphviz endpoint would be much appreciated
PS: Sorry for the image instead of text. The URLs are important to communicating my question but I get an error when I try to make a post with quickchart URLs. I have emailed support in regards to this issue on their forums
No problem. With that in mind, I found a javascript way to create a temporary URL in the calling program.
Here is my workaround code in case anyone needs it in the future.
// END USING POST REQUEST
// FYI: "It can take a couple seconds for short URLs to become active globally.
console.log("Request string too long. Making a POST request. (This may take longer)")
const postRequestBody = {
"graph": diagramTextStr,
"layout": diagramLayoutEngine,
"format": "svg", // Temporary storage (below) is expecting SVG format.
};
let response = await context.fetcher.fetch({
disableAuthentication: true,
url: "https://quickchart.io/graphviz", // The Graphviz endpoint cannot return a shortURL
isBinaryResponse: true, // Since cannot get short URL. Get Binary SVG file instead
method: "POST",
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(postRequestBody),
});
console.log("responseJSON: " + JSON.stringify(response));
let svgAsBinaryResponse = response.body;
let temporaryImageUrl = await context.temporaryBlobStorage.storeBlob(svgAsBinaryResponse, "image/svg+xml");
return temporaryImageUrl;
}