Finding a Metadata Endpoint – How to get the full path URL

Metadata endpoints are critical pieces of the puzzle in any file uploaded to Filepicker. It is used to expose additional information regarding services or applications. Metadata also allows for info developers need to find it on their own. The alternative is trying to hunt it down blindly, or ask a publisher for a copy via email.

Metadata Example

Using the following URL, you can find out what type of file was uploaded:

https://www.filestack.com/api/file/hFHUCB3iTxyMzseuWOgG/metadata?mimetype=true

{"mimetype": "image/png"}

There is always an easier way to do things, you just need to know what that easier path is in order to follow it. Filepicker allows users to create content in an application and then easily save that content for exporting later on to a different device. However, once content has been created, it can be difficult to locate.

How to get the full path URL

First, users need to know that every file created in Filepicker gets its own unique URL that identifies it in the Javascript libraries. That FilePicker URL serves as a road map of sorts to finding a particular file you might be hunting down.

If you know the bucket name, and have the unique URL, you can generate the path to the file.

Example

/*InkBlob from a previous pick, etc.*/
var inkblob = { url: 'https://www.filestack.com/api/file/H7KYuWy1S3e1qvG2M66i' };
console.log("Loading path...");
filepicker.stat(inkblob, {path: true},
  function(metadata){
    console.log(JSON.stringify(metadata));
});

Result

Loading path...
{"path":"jBGB0lRDSmyBzv1aYkUQ_IMAG0038.jpg","key":"jBGB0lRDSmyBzv1aYkUQ_IMAG0038.jpg"}

User content can be found on both Rest API and Javascript with a simple GET command. The GET command works on the unique URL of the content, and can also be used to get metadata on the field or to search for specific metadata values.

You can also get lots of info about the file, without having to download it by using our REST API. Simply With a simple HEAD request you can find out simple info such as: specific type (PNG image) or size (276839).

For a full list of properties you can read, view our documentation.

Head Request Example:

>>> curl -i -X HEAD https://www.filestack.com/api/file/WE48V05bQrq7AZ32k3kV

Result

HTTP/1.1 200 OK
...
Content-Type: image/png
Content-Length: 276839
Content-Disposition: inline; filename="GET_demo.png"
X-File-Name: GET_demo.png
...

If you’re getting stuck, send a note:
Contact Support

Read More →