Skip to content Skip to main navigation Skip to footer

How do I access my photos through API or direct link?

With the introduction of our Collected Media folder, it’s now easier to find a specific image (photo, signature) collected for a feature in a specific data collection project, as they are now automatically stored in the corresponding map and layer folders (see image below and our guide here).

However, you might be wondering if there’s a way for you to access your photo through API or get a direct link to the image (not just the user interface). The answer is, of course, yes! Here are some options to consider:

Table of Contents

Get a feature media file using REST API

If you need to access a particular image attached to a feature, you can retrieve it using the REST API. This allows you to programmatically access images for external applications, reports, or integrations.

API Endpoint:

GET https://api.giscloud.com/1/layers/{LAYER_ID}/features/{FEATURE_ID}/{ATTRIBUTE_NAME}/{FILE_NAME}.json

 Example Use Case:

  • Fetch a photo linked to a specific feature in a dataset.
  • Access images for automated processing or reporting.
  • Embed direct media links into external dashboards or web applications.

For the full API documentation and additional query options, please refer to our GIS Cloud REST API Docs.


If you have the resource ID, you can directly access an image using the following link format:

https://editor.giscloud.com/rest/1/layers/LAYER_ID/features/FEATURE_ID/FIELD_NAME/resources/RESOURCE_ID

Replace the placeholders (LAYER_ID, FEATURE_ID, FIELD_NAME, RESOURCE_ID) with the correct values from your project.

For example, for an image with these values:

Resource ID = 36984602
Field Name = photo
Feature ID = 18
Layer ID = 5719134

Your direct link would be:

https://editor.giscloud.com/rest/1/layers/5719134/features/18/photo/resources/36984602

Note: You must be logged in as the owner of the resource or use the owner’s API key to access the image.


If you have the file path, you can access the image using this format:

https://editor.giscloud.com/rest/1/layers/LAYER_ID/features/FEATURE_ID/FIELD_NAME/FILE_PATH

For example, for an image with these values:

File Path = /uploads/mdc_photo_mdc_1874a3_cdv_photo_1738573574_1738573582838.jpg
Field Name = photo
Feature ID = 18
Layer ID = 5719134

Your direct link would be:

https://editor.giscloud.com/rest/1/layers/5719134/features/18/photo/uploads/mdc_photo_mdc_1874a3_cdv_photo_1738573574_1738573582838.jpg

Note: As with the resource ID method, you must be logged in as the owner or use the owner’s API key to access the file.


Finding the Resource ID from Feature Details

If you have a feature ID, you can retrieve its resource ID by fetching the feature details using the GIS Cloud API. This method provides a JSON response containing various attributes, including media attachments like photos.

Step 1: Get Feature Details

Use the following API request to fetch feature details:

https://api.giscloud.com/1/layers/LAYER_ID/features/FEATURE_ID.json

Step 2: Locate the Resource ID in the Response

The API will return a JSON response containing all feature details. Media files (e.g., photos) are stored under the data section in a field like "photo".

Example JSON Response (Excerpt):

"photo": "___json[{\"pathname\":\"/uploads/mdc_photo_mdc_1874a3_cdv_photo_1738573574_1738573582838.jpg\",\"rid\":36984602,\"lid\":\"5719134\",\"fid\":\"18\",\"field\":\"photo\",\"title\":\"mdc_photo_mdc_1874a3_cdv_photo_1738573574_1738573582838.jpg\",\"ext\":\"jpg\",\"panorama\":false,\"isDir\":false}]"

Step 3: Extract the Resource ID

Inside the "photo" field, you will find a JSON object that contains key details about the file, including:

  • "pathname" → The file path
  • "rid" → The resource ID (36984602 in this case)
  • "lid" → The layer ID (5719134)
  • "fid" → The feature ID (18)
  • "field" → The field name (photo)

Step 4: Use the Resource ID to Access the Photo

Now that you have the resource ID, you can use it to get a direct link to the image using the method described earlier:

https://editor.giscloud.com/rest/1/layers/5719134/features/18/photo/resources/36984602

Finding the Resource ID If You Have the File Path

If you only have the file path, you can retrieve the corresponding resource ID by making the following request:

https://editor.giscloud.com/rest/1/files/PATH_AND_FILE_NAME/bypath.json

Example Request:

https://editor.giscloud.com/rest/1/files/uploads/mdc_photo_mdc_1874a3_cdv_photo_1738573574_1738573582838.jpg/bypath.json

This request returns a JSON response containing the resource ID, which you can then use to access the image as shown in the previous section.


Finding the File Path If You Have the Resource ID

If you have the resource ID but need the file path, follow these steps:

1. Retrieve file details using the resource ID:

https://editor.giscloud.com/rest/1/resources/RESOURCE_ID

Example Request:

https://editor.giscloud.com/rest/1/resources/36984602

This returns an XML response containing the target resource ID (target_resource_id).

2. Then, use the target resource ID to send a request to the /files endpoint where you can get the filename and the pathname.

https://editor.giscloud.com/rest/1/files/TARGET_RESOURCE_ID

Example Request:

https://editor.giscloud.com/rest/1/files/21561242

This response provides both the filename and pathname, allowing you to reconstruct the direct file link.

Don’t hesitate to reach out to us directly (through our chatbox or by sending an email to premium-support@giscloud.com) if you have any questions or need additional support with these steps!

Was This Article Helpful?