### cURL Example for Lightroom API Call Source: https://developer.adobe.com/lightroom/lightroom-api-docs/guides/calling_api This snippet demonstrates how to make a GET request to the Lightroom API using cURL. It shows how to include the API key and access token in the request headers for authentication. ```cURL curl -H "X-API-Key: ${key}" -H "Authorization: Bearer ${token}" https://lr.adobe.io/v2/... ``` -------------------------------- ### Node.js Lightroom API Authentication Sample Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/authenticate_customers This Node.js sample demonstrates the OAuth authentication workflow for the Lightroom API. It requires replacing the 'creative_sdk' scope with 'lr_partner_apis,lr_partner_rendition_apis' and following the provided ReadMe instructions for setup and execution. ```javascript /* Node.js sample for Lightroom API OAuth Integration. Replace 'creative_sdk' scope with 'lr_partner_apis,lr_partner_rendition_apis'. Refer to the ReadMe for detailed instructions. */ // Example placeholder for server/index.js content console.log('Node.js Lightroom API Authentication Sample'); // ... actual OAuth flow implementation ... ``` -------------------------------- ### JavaScript Example for Lightroom API Call Source: https://developer.adobe.com/lightroom/lightroom-api-docs/guides/calling_api This JavaScript code illustrates how to make an authenticated GET request to the Lightroom API using the XMLHttpRequest object. It shows how to set the necessary headers for API key and bearer token. ```JavaScript var key='ClientAPIKey' var token='eyJ4NXUi...' var xhr = new XMLHttpRequest() xhr.open('GET', apiURL) xhr.setRequestHeader('X-API-Key', key) xhr.setRequestHeader('Authorization', `Bearer ${token}`) ``` -------------------------------- ### Python Lightroom API Authentication Sample Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/authenticate_customers This Python sample illustrates the OAuth authentication process for the Lightroom API. Users need to substitute the 'creative_sdk' scope with 'lr_partner_apis,lr_partner_rendition_apis' and adhere to the ReadMe's guidance for running the application. ```python # Python sample for Lightroom API OAuth Integration. # Replace 'creative_sdk' scope with 'lr_partner_apis,lr_partner_rendition_apis'. # Refer to the ReadMe for detailed instructions. print('Python Lightroom API Authentication Sample') # ... actual OAuth flow implementation ... ``` -------------------------------- ### Lightroom Services API Sample Code Source: https://developer.adobe.com/lightroom/lightroom-api-docs/code-sample Sample code demonstrating the use of the Lightroom Services APIs. These samples are hosted in a subdirectory of the Lightroom Services GitHub repository, providing practical examples for developers to integrate with Lightroom functionalities. ```GitHub See subdirectory of the Lightroom Services GitHub repository. ``` -------------------------------- ### Constructing API URLs with Base and Links Source: https://developer.adobe.com/lightroom/lightroom-api-docs/guides/links_and_pagination This example demonstrates how to construct API endpoints by concatenating a base URL with relative link hrefs, as returned by the Lightroom API. It emphasizes using standard URI resolution rules. ```json { "base": "https://lr.adobe.io/v2/catalogs/18c23e15/", ... "links" { "self": { "href": "/v2/catalogs/18c23e15" }, "/rels/albums": { "href": "albums" } } } ``` -------------------------------- ### Check Customer Catalog - GET /v2/catalog Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/upload_content Fetches the user catalog if the customer is entitled. Requires an authorization token and specifies the content type as JSON. The response includes catalog details like base URL, ID, type, and links to related resources. ```HTTP GET /v2/catalog HTTP/1.1 Authorization: {auth_token} Content-Type: application/json Content-Length: {xsd:nonNegativeInteger} ``` -------------------------------- ### Lightroom API: Read Rendition (GET) Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/read_generate_renditions Retrieves the generated rendition data for a specific asset and rendition type. This GET request is made after confirming the rendition's availability via a HEAD call. It requires an authorization token and returns a '200 OK' status with the rendition bits upon success. ```HTTP GET /v2/catalogs/{catalog_id}/assets/{asset_id}/renditions/ HTTP/1.1 Authorization: {auth_token} ``` -------------------------------- ### Get Lightroom Account Information Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/upload_content This API call retrieves the user's Lightroom account information. It is used to check user entitlement status and storage usage. The `entitlement.status` should be 'subscriber' or 'trial', and `entitlement.storage.used` should be less than `entitlement.storage.limit`. ```HTTP GET /v2/account ``` -------------------------------- ### Invalid Request Response Example Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api Illustrates a typical JSON response when a request fails due to input validation errors. It includes an 'errors' object detailing the issue and a 'code' and 'description' for the error. ```json { "errors": { "body": [ "Must be a valid JSON" ] }, "code": 1005, "description": "Input Validation Error" } ``` -------------------------------- ### Check Customer Entitlement Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/upload_content This API call retrieves customer account information to verify their Creative Cloud entitlement. It requires a GET request to the /v2/account endpoint with an Authorization header. The response includes entitlement status, trial information, storage details, and other account-specific data. ```HTTP GET /v2/account HTTP/1.1 Authorization: {auth_token} Content-Type: application/json Content-Length: {xsd:nonNegativeInteger} ``` -------------------------------- ### Get Album Response Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api Sample response for retrieving album details from the Lightroom API, including base URL, album ID, type, subtype, creation/update timestamps, payload, and various links to related resources. ```json { "base": "/v2/catalogs//", "id": "", "type": "album", "subtype": "", "created": "", "updated": "", "payload": { "name": "", "cover": { "id": "" }, "parent": { "id": "" } }, "links": { "self": { "href": "albums/" }, "/rels/album_assets": { "href": "albums//assets?embed=asset" }, "/rels/parent_album": { "href": "albums/" }, "/rels/cover_asset": { "href": "assets/" }, "/rels/rendition_type/320": { "href": "assets//renditions/320" }, "/rels/rendition_type/640": { "href": "assets//renditions/640" }, "/rels/rendition_type/1280": { "href": "assets//renditions/1280" }, "/rels/rendition_type/2048": { "href": "assets//renditions/2048" } } } ``` -------------------------------- ### Lightroom API: Create Asset External XMP Develop Setting (XML) Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api This is an example of an XML string used as the request body when uploading an external XMP develop setting file directly for an asset. The content type should be 'application/rdf+xml'. ```xml ``` -------------------------------- ### Upload Image or Video - PUT /v2/catalogs/{catalog_id}/assets/{asset_id} Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/upload_content Creates an asset within a specified catalog using a globally unique identifier (GUID). Requires an authorization token, catalog ID, and asset ID. The request body includes asset subtype and payload details such as capture date and import source information. ```HTTP PUT /v2/catalogs/{catalog_id}/assets/{asset_id} HTTP/1.1 Authorization: {auth_token} Content-Type: application/json Content-Length: {xsd:nonNegativeInteger} If-None-Match: {xsd:string} { "subtype": "{asset_subtype}", "payload": { "captureDate": "0000-00-00T00:00:00", "importSource": { "fileName": "{file_name}", "importedOnDevice": "{import_device_name}", "importedBy": "{import_account_id}", "importTimestamp": "{import_time}" } } } ``` -------------------------------- ### Get Lightroom Services Health Check Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api Checks the health status of Lightroom services. Returns the server version ID if services are operational. Requires an X-API-Key. ```HTTP GET /v2/health Host: lr.adobe.io X-API-Key: YOUR_API_KEY ``` -------------------------------- ### Get Lightroom Catalog Information Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/upload_content This API call retrieves the user's Lightroom catalog information. It is used to check if a user has an existing catalog or if a new one can be generated. A '403' error is returned if the user has no catalog and a new one cannot be generated. ```HTTP GET /v2/catalog ``` -------------------------------- ### Get Asset Rendition Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api Retrieves a specific rendition of an asset. Returns a 404 error if the rendition does not exist or is invalid. Supports various rendition types like 'thumbnail2x', 'fullsize', and different resolutions. -------------------------------- ### Invalid Request Response Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api Example of an error response when an invalid request is made to the Lightroom API, typically due to input validation errors. ```json { "errors": { "body": [ "Must be a valid JSON" ] }, "code": 1005, "description": "Input Validation Error" } ``` -------------------------------- ### Lightroom API: Get Catalog Asset Source: https://developer.adobe.com/lightroom/lightroom-api-docs/release-notes Retrieves a specific asset from a catalog. Revision IDs have been removed from the response in version 1.2.1. This API can also be used to create master links and xmp develop links. ```HTTP GET /v2/catalogs/{catalog_id}/assets/{asset_id} ``` -------------------------------- ### Check Lightroom Service Health Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/upload_content This endpoint allows you to query the health status of the Lightroom service. It requires a GET request to the /v2/health endpoint. A successful response will return an HTTP 200 OK status with a JSON payload containing the service version. ```HTTP GET /v2/health HTTP/1.1 ``` -------------------------------- ### Lightroom API: Get Asset External XMP Develop Setting Response (JSON) Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api This JSON response is returned when attempting to retrieve an asset's external XMP develop setting. It indicates an input validation error, potentially due to an invalid asset ID. ```json { "errors": { "asset_id": [ "Must be a valid GUID" ] }, "code": 1005, "description": "Input Validation Error" } ``` -------------------------------- ### Lightroom API Common JSON Data Model Example Source: https://developer.adobe.com/lightroom/lightroom-api-docs/guides/common_data_model This JSON object represents a common data model structure used in the Lightroom API. It includes fields for base URL, unique identifiers, creation and update timestamps, asset type and subtype, an optional payload for metadata, and links to related resources. ```json { "base": "https://lr.adobe.io/v2/catalogs/9479135e/", "id": "a3c679e3", "created": "2012-01-03T04:54:32.884643Z", "updated": "2012-01-03T04:54:32.884643Z", "type": "custom for each type", "subtype": "custom for each type", "payload": { "userCreated": "2012-01-03T04:54:15Z", "userUpdated": "2012-01-03T04:54:15Z" }, "links": { "self": { "href": "custom/for/each/type/a3c679e3" } } } ``` -------------------------------- ### Lightroom API: Generate Renditions (POST) Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/read_generate_renditions Initiates the asynchronous generation of specified renditions (e.g., fullsize, 2560) for a given asset. Requires an authorization token and specifies the desired rendition types in the 'X-Generate-Renditions' header. A '202 Accepted' response indicates the request was successful. ```HTTP POST /v2/catalogs/{catalog_id}/assets/{asset_id}/renditions HTTP/1.1 Authorization: {auth_token} X-Generate-Renditions: {fullsize,2560} ``` -------------------------------- ### Enumerate Project Albums Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/manage_content Retrieve a list of project albums associated with a partner application within a specific catalog. The response contains an array of albums in the 'resources' field, which will be empty if no albums are found. ```Bash GET /v2/catalogs/{catalog_id}/albums?subtype=project ``` -------------------------------- ### Lightroom API: Invalid Request Response (JSON) Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api This JSON response indicates an invalid request, detailing errors related to rendition type or GUID. It includes an error code and a description of the validation issue. ```json { "errors": { "rendition_id": [ "Must be a valid GUID" ] }, "code": 1005, "description": "Input Validation Error" } ``` -------------------------------- ### Lightroom API Account Metadata Response (200 OK) Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api Sample JSON response containing the user's account metadata, including details about their subscription and storage. ```JSON { "base": "https://lr.adobe.io/", "id": "96e656e3812b4c2fb670fa74b6a7ad74", "type": "account", "created": "2017-09-12T17:22:41.751746Z", "updated": "2019-02-02T17:17:39.663862Z", "email": "customer@domain.com", "full_name": "Adobe Customer", "first_name": "Adobe", "last_name": "Customer", "wcd_guid": "6CEE5CFE464CC743992017B8", "country": "US", "config": { "nimbus_show_different_ui": true, "search_index": true, "purge_assets_after": 5184000 }, "entitlement": { "status": "subscriber", "trial": { "start": "2017-09-12T17:22:41.751746Z", "end": "2018-02-16T10:35:24.593005Z" }, "current_subs": { "product_id": "lightroom", "store": "adobe", "purchase_date": "2019-02-04T07:25:59.121277Z", "sao": { "inpkg_CCLE": "0", "inpkg_CCSN": "0", "inpkg_LRMP": "1", "inpkg_PHLT": "0" } }, "storage": { "used": 11998409416, "warn": 85899345920, "limit": 112742891520, "display_limit": 107374182400 }, "deletion_date": "2020-05-06T15:17:51.216255Z" } } ``` -------------------------------- ### Check Lightroom Services Health (cURL) Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/service_health_check This cURL command checks the health of the Lightroom Services by sending a GET request to the `/v2/health` endpoint with the necessary API key. It demonstrates the basic interaction with the service. ```cURL curl -H "X-API-Key: NEW_API_KEY" https://lr.adobe.io/v2/health ``` -------------------------------- ### Create Project Album - PUT Request Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/manage_content This snippet demonstrates the HTTP PUT request to create a new project album within a Lightroom catalog. It requires the catalog ID and a unique album ID. The request body specifies the album's subtype as 'project' and includes service-specific information. ```Bash PUT /v2/catalogs/{catalog_id}/albums/{album_id} ``` -------------------------------- ### Add Assets to Project Album Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/manage_content Add one or more assets to a specified project album. This API call supports adding up to 50 assets per request and allows for custom metadata such as cover image designation and ordering. ```Bash PUT /v2/catalogs/{catalog_id}/albums/{album_id}/assets ``` -------------------------------- ### Project Album Request Body Structure Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/manage_content This JSON structure defines the payload for creating a project album. It includes fields for the album's name, creation/update timestamps, and publish information such as version, deletion status, remote IDs, and links to external content. ```JSON { "subtype": "project", "serviceId": "", "payload": { "userCreated": "2012-01-03T04:54:15Z", "userUpdated": "2012-01-03T04:54:15Z", "name": "Crivitz", "publishInfo": { "version": 3, "created": "2017-08-03T04:54:32.884643Z", "updated": "2017-08-03T04:54:32.884643Z", "deleted": true, "remoteId": "seRviC3-sp3c1fic", "remoteLinks": { "edit": { "href": "https://external.site.com/editor/albums/afd05f03" }, "view": { "href": "https://external.site.com/albums/afd05f03" } }, "servicePayload": "service-specific string" } } } ``` -------------------------------- ### Upload Image or Video Binary - PUT /v2/catalogs/{catalog_id}/assets/{asset_id}/master Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/upload_content Uploads the binary data for an image or video file. Supports uploads up to 200MB per invocation. For larger files, use `Content-Range` headers to upload in chunks. Requires authorization token, catalog ID, asset ID, and content details. ```HTTP PUT /v2/catalogs/{catalog_id}/assets/{asset_id}/master HTTP/1.1 Authorization: {auth_token} Content-Length: {xsd:nonNegativeInteger} Content-Range: {xsd:string} Content-Type: {xsd:string} ``` -------------------------------- ### Lightroom API: Create Asset External XMP Develop Setting (JSON) Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api This JSON snippet shows the request body for creating an external XMP develop setting file by copying from another asset. It requires the 'file_href' pointing to the source asset's XMP develop setting. ```json { "file_href": "/v2/catalogs/{catalog_id}/assets/{source_asset_id}/xmp/develop" } ``` -------------------------------- ### Lightroom Catalog Response Sample Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api This JSON object represents a successful response when retrieving catalog information. It includes creation and update timestamps, base API URL, catalog ID, type, subtype, payload with user details and settings, and links to related resources. ```json { "created": "2019-07-02T15:16:13.556610Z", "updated": "2019-07-02T15:26:42.838366Z", "base": "https://lr.adobe.io/v2/", "id": "bf7337d9355c41b7875c9392f918362a", "type": "catalog", "subtype": "lightroom", "payload": { "userCreated": "2019-07-02T15:38:14Z", "userUpdated": "2019-08-16T16:05:13Z", "name": "Lightroom Classic Catalog Name", "presets": { "favorites": { "09E4A533BEFC4AC582FCF1EF953EB150": true, "30E266DB24AE09B97DC3DD687AC298B1": false, "5C9AF6F007B96EF1E0DED43E77BE87C3": true } }, "profiles": { "favorites": { "53A4A533BAFB4AB582FBF1AF353AB155": true, "35A266DB24AA53B37DB3DD687AB238B1": true, "5B3AF6F557B36AF1A5DAD43A77BA87B3": false } }, "settings": { "universal": { "connections": { "connection_api_key": { "created": "2019-07-02T15:26:42.838366Z" } } }, "desktop": { "desktop_key": "desktop_setting" }, "web": { "web_key": "web_setting" }, "mobile": { "mobile_key": "mobile_setting" }, "photosdk": { "sdk_key": "sdk_setting" } } }, "links": { "self": { "href": "catalogs/bf7337d9355c41b7875c9392f918362a" }, "/rels/subtyped_albums": { "href": "catalogs/bf7337d9355c41b7875c9392f918362a/albums?subtype={subtype}", "templated": true }, "/rels/subtyped_assets": { "href": "catalogs/bf7337d9355c41b7875c9392f918362a/assets?subtype={subtype}", "templated": true } } } ``` -------------------------------- ### Lightroom API - Album Asset Response Sample Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api This JSON snippet represents a sample response from the Lightroom API, detailing the structure of album resources. It includes base information, a list of resources with their IDs, creation and update timestamps, type, subtype, service ID, and a payload containing user-created/updated information, name, cover details, parent album information, and publish details. ```json { "base": "string", "resources": [ { "id": "string", "created": "string", "updated": "string", "type": "album", "subtype": "project", "serviceId": "string", "payload": { "userCreated": "string", "userUpdated": "string", "name": "string", "cover": { "id": "string" }, "parent": { "id": "string" }, "publishInfo": { "servicePayload": "string", "remoteId": "string", "created": "string", "updated": "string", "deleted": true, "remoteLinks": { "edit": { "href": "string" }, "view": { "href": "string" } } } }, "links": {} } ] } ``` -------------------------------- ### Lightroom Create Asset Request Sample Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api This JSON object represents the request body for creating a new asset in Lightroom. It specifies the asset's subtype (e.g., 'image') and includes a payload with initial metadata such as user details, capture date, and import information. ```json { "subtype": "image", "payload": { "userCreated": "string", "userUpdated": "string", "captureDate": "0000-00-00T00:00:00", "importSource": { "fileName": "string", "importedOnDevice": "string", "importedBy": "string", "importTimestamp": "string" } } } ``` -------------------------------- ### Format Datetime for API Submission Source: https://developer.adobe.com/lightroom/lightroom-api-docs/guides/primitive_data_types Provides examples of formatting datetime values for the Lightroom API, including handling date-only formats and specifying UTC time with the 'Z' indicator. It also covers substituting default values for required fields when dates are invalid. ```javascript // Example: Date only format let dateOnly = "2017-03-09"; // Example: Datetime with UTC timezone let utcDatetime = "2017-03-09T00:00:00Z"; // Example: Handling required fields with default values let assetPayload = { captureDate: "0000-00-00T00:00:00", // For unknown capture dates importSource: { importTimestamp: new Date().toISOString() // Substitute current time for importTimestamp } }; console.log(dateOnly); console.log(utcDatetime); console.log(assetPayload); ``` -------------------------------- ### Add Assets Request Body Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/manage_content The request body for adding assets to a project album. It includes an array of resources, each specifying an asset ID and optional payload for cover image settings and custom order. ```JSON { "resources": [ { "id": "", "payload": { "cover": true, "order": "string", "publishInfo": { "remoteId": "seRviC3-sp3c1fic", "servicePayload": "service-specific string" } } }, ... ] } ``` -------------------------------- ### Lightroom API - Add Assets to Album Response Sample Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api This JSON snippet represents a sample response after attempting to add assets to an album via the Lightroom API. It includes a 'base' URL, a list of 'resources' with their IDs and HREFs, and an 'errors' array detailing any issues encountered during the process, including asset-specific errors. ```json { "base": "string", "resources": [ { "id": "string", "href": "string" } ], "errors": [ { "id": "string", "http_status": 0, "code": 0, "description": "string", "subtype": "string", "errors": { "asset": [ "string" ] } } ] } ``` -------------------------------- ### Create Album Request Payload Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api Defines the structure for creating a new album in Lightroom, including metadata like subtype, service ID, and optional payload details for user-created, user-updated, name, cover, and parent information. ```json { "subtype": "project", "serviceId": "string", "payload": { "userCreated": "string", "userUpdated": "string", "name": "string", "cover": { "id": "string" }, "parent": { "id": "string" }, "publishInfo": { "servicePayload": "string", "remoteId": "string", "created": "string", "updated": "string", "deleted": true, "remoteLinks": { "edit": { "href": "string" }, "view": { "href": "string" } } } } } ``` -------------------------------- ### Lightroom API: Create Asset Source: https://developer.adobe.com/lightroom/lightroom-api-docs/release-notes Creates a new asset with initial metadata and import information. This API was introduced in version 1.1.0. The previous version of this API (PUT - /v2/catalogs/{catalog_id}/assets/{asset_id}/revisions/{revision_id}) is deprecated. ```HTTP PUT /v2/catalogs/{catalog_id}/assets/{asset_id} ``` -------------------------------- ### Retrieve Lightroom User Catalog Metadata Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api Retrieves metadata for the authenticated user's catalog, which serves as the primary container for resources like assets and albums. Requires an X-API-Key and an Authorization token. ```HTTP GET /v2/catalog Host: lr.adobe.io X-API-Key: YOUR_API_KEY Authorization: Bearer YOUR_ACCESS_TOKEN ``` -------------------------------- ### Retrieve Lightroom User Account Metadata Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api Fetches the authenticated user's account metadata, including personal information and subscription status. Requires an X-API-Key and an Authorization token. ```HTTP GET /v2/account Host: lr.adobe.io X-API-Key: YOUR_API_KEY Authorization: Bearer YOUR_ACCESS_TOKEN ``` -------------------------------- ### Authenticate Lightroom API Request Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api This snippet shows the necessary header parameters for authenticating requests to the Lightroom API. It requires a client ID (API Key) and a user access token. ```HTTP GET https://lr.adobe.io/v2/catalogs/{catalog_id}/assets Host: lr.adobe.io X-API-Key: YOUR_CLIENT_ID Authorization: Bearer YOUR_ACCESS_TOKEN ``` -------------------------------- ### Invalid API Key Error Response Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/upload_content This JSON object represents an error response when an invalid API key is provided. The API will return an HTTP 403 error with this structure. The partner application must include a valid API key in the 'X-API-Key' header. ```JSON { "error_code": "403003", "message": "Api Key is invalid" } ``` -------------------------------- ### Generate Asset Renditions Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api Asynchronously generates specified renditions (e.g., fullsize, 2560) for an asset. Generated renditions are automatically deleted after one day. Requires catalog and asset IDs, along with API key and authorization. ```json { "base": "", "links": { "/rels/rendition_type/": { "href": "assets//renditions/" } } } ``` -------------------------------- ### Retrieve Assets with Query Parameters Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api This snippet demonstrates how to construct a request to the Lightroom API to retrieve assets based on various query parameters. It includes parameters for filtering by date, limit, hash, stack visibility, subtype, asset IDs, exclusion criteria, and grouping/naming preferences. ```HTTP GET https://lr.adobe.io/v2/catalogs/{catalog_id}/assets?updated_since=YYYY-MM-DDTHH:MM:SSZ&captured_before=YYYY-MM-DDTHH:MM:SSZ&captured_after=YYYY-MM-DDTHH:MM:SSZ&limit=500&sha256=abcdef123456...&hide_stacked_assets=true&subtype=subtype1;subtype2&asset_ids=id1,id2&exclude=incomplete&group=group1;group2&name=name1;name2&favorite=true ``` -------------------------------- ### Retrieve Albums Query Parameters Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api Outlines the query parameters available for retrieving a list of albums. Supports filtering by subtype, pagination using 'name_after', and limiting the number of results. ```json { "catalog_id": "string", "subtype": "string", "name_after": "string", "limit": "integer", "X-API-Key": "string", "Authorization": "Bearer [token]" } ``` -------------------------------- ### Lightroom API Health Check Response (200 OK) Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api Sample JSON response indicating a successful health check for Lightroom services, including the server version. ```JSON { "version": "string" } ``` -------------------------------- ### Recursive Pagination in JavaScript Source: https://developer.adobe.com/lightroom/lightroom-api-docs/guides/links_and_pagination This JavaScript function recursively fetches paginated content from an API. It concatenates the base URL with the 'next' link's href to retrieve subsequent pages until all content is collected. ```javascript function getPagedJSONContentP(url) { return new Promise(function(resolve, reject) { var response = { resources: [] } function getPage(url) { getJSONContentP(url).then(function(page) { response.base = page.base response.resources = response.resources.concat(page.resources) if (page.links.next) { getPage(page.base + page.links.next.href) } else { resolve(response) } }, reject) } getPage(url) }) } ``` -------------------------------- ### Lightroom API: Create External Develop XMP Source: https://developer.adobe.com/lightroom/lightroom-api-docs/release-notes Uploads an external XMP develop file for an asset. This API was added in version 1.1.0. ```HTTP PUT /v2/catalogs/{catalog_id}/assets/{asset_id}/xmp/develop ``` -------------------------------- ### Lightroom API: Create Master Source: https://developer.adobe.com/lightroom/lightroom-api-docs/release-notes Uploads the master file for a new asset. This API was introduced in version 1.2.0. The previous version of this API (PUT - /v2/catalogs/{catalog_id}/assets/{asset_id}/revisions/{revision_id}/master) is deprecated. ```HTTP PUT /v2/catalogs/{catalog_id}/assets/{asset_id}/master ``` -------------------------------- ### Lightroom API: Catalog ID Change Error (HTTP 404) Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/upload_content Explains the 'Catalog_id change' error, indicated by an HTTP 404 (Not Found) response, which occurs when an asset creation call uses an outdated catalog ID. Partner applications should re-fetch the latest catalog ID using the 'Retrieve the user catalog metadata' API and update their cache. ```JSON { "code":1000, "description":"Resource not found", "subtype":"ResourceNotFoundError", "errors":{"catalog":["does not exist"]} } ``` -------------------------------- ### Lightroom API: Retrieve Assets Source: https://developer.adobe.com/lightroom/lightroom-api-docs/release-notes Retrieves a list of assets within a catalog. Revision IDs have been removed from the response in version 1.2.1. This API can also be used to create master links and xmp develop links. ```HTTP GET /v2/catalogs/{catalog_id}/assets ``` -------------------------------- ### Lightroom API JSON Response Structure Source: https://developer.adobe.com/lightroom/lightroom-api-docs/api This JSON structure represents a successful response from the Lightroom API, detailing album information and a list of assets within that album. It includes metadata for both image and video assets, along with links for navigation and related actions. ```json { "base": "", "album": { "id": "", "links": { "self": { "href": "albums/" } } }, "resources": [ { "id": "", "type": "album_asset", "created": "", "updated": "", "links": { "self": { "href": "albums//assets/" } }, "asset": { "id": "", "type": "asset", "subtype": "image", "created": "", "updated": "", "links": { "self": { "href": "assets/" }, "/rels/master_create": { "href": "assets//master" }, "/rels/xmp_develop_create": { "href": "assets//xmp/develop" }, "/rels/rendition_type/": { "href": "assets//renditions/" }, "/rels/xmp/develop": { "href": "assets//xmp/develop", "invalid": "true", "fileSize": "" } }, "payload": { "captureDate": "", "importSource": { "fileName": "", "fileSize": "", "originalWidth": "", "originalHeight": "", "sha256": "", "importedOnDevice": "", "importedBy": "", "importTimestamp": "" }, "": "", "develop": { "": "" } } }, "payload": { "order": "", "cover": true, "": "" } }, { "id": "", "type": "album_asset", "created": "", "updated": "", "links": { "self": { "href": "albums//assets/" } }, "asset": { "id": "", "type": "asset", "subtype": "video", "created": "", "updated": "", "links": { "self": { "href": "assets/" }, "/rels/master_create": { "href": "assets//master" }, "/rels/xmp_develop_create": { "href": "assets//xmp/develop" }, "/rels/rendition_type/": { "href": "assets//renditions/" }, "/rels/xmp/develop": { "href": "assets//xmp/develop", "invalid": "true", "fileSize": "" } }, "payload": { "captureDate": "", "importSource": { "fileName": "", "fileSize": "", "originalWidth": "", "originalHeight": "", "sha256": "", "importedOnDevice": "", "importedBy": "", "importTimestamp": "" }, "video": { "frameRate": [ "", "" ], "duration": [ "", "" ], "displayAspectRatio": [ "", "" ], "storageWidth": "", "storageHeight": "" }, "": "", "develop": { "": "" } } } } ], "links": { "prev": { "href": "albums//assets?captured_after=" }, "next": { "href": "albums//assets?captured_before=" } } } ``` -------------------------------- ### Lightroom API: JSON Validation Failed Error (HTTP 400) Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/upload_content Details the 'JSON Validation failed' error encountered during asset creation. An HTTP 400 status code indicates that the provided JSON body is invalid, contains unsupported fields, or has illegal properties. Partner applications must correct the JSON content before retrying. ```JSON { "error_code": "1005", "message": "Input validation error" } ``` -------------------------------- ### Lightroom API: Content Type Mismatch Error (HTTP 415) Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/upload_content Addresses the 'Content type mismatch' error when uploading an original file. An HTTP 415 status code signifies this issue, which arises from an incorrect content type. Partner applications should validate the content type against the upload data and retry the operation. ```JSON { "error_code": "1007", "message": "Invalid content type" } ``` -------------------------------- ### Lightroom API: Insufficient Storage Error (HTTP 413) Source: https://developer.adobe.com/lightroom/lightroom-api-docs/getting-started/upload_content Handles the 'Insufficient storage' error when attempting to upload an original file. This error, indicated by an HTTP 413 status code, occurs when the user's storage is full. Partner applications should inform the user about the storage limit and cease further upload attempts. ```JSON { "error_code": "1007", "message": "The resource is too big" } ```