External link to image provided by a generic api

Hi all,

I’m hoping to be able to return a URL to an image from a generic API endpoint in Create. The image is a file property on a general object. The image URL needs to be accessible to someone who isn’t logged in to Create.

I currently have an API function that searches for the record and returns the data using a JSON payload. In the JSON payload I’m using a preprocessor to get the URL to the file I’m after.

The problem I’m hitting is that the URL is always an ‘internal’ liberty URL that needs a user to be logged in to access.

image

Which returns:

Is there a way I can generate a link to this which would not require the browser to have an active session logged into Create? I’m wanting to use this in some automated tasks where logging in won’t be feasible.

Thanks for any help.

Kind regards,
Joe @ Tewkesbury

Afternoon Joe,

Yes this is possible, but for security reasons we don’t just allow files to be accessible on a regular interface.

You can create a generic API that takes a record ID or similar as a parameter and then responds with the file/image as if it was a regular get request.

In this way you can wrap the request in a layer of security by adding a security token, user credential and/or hiding it behind a firewall.

You’ll need to add an appropriate ‘content-type’ header if you want a browser or other app to handle the file correctly.

If this is subject to change, you may need to create a response data processor to change the headers in-line with the mime type of the requested file.

The matched file can simply be dropped in as the payload response, Create will handle the rest.

image

Any further questions, please let me know.