Sample Code
Lightroom
Apply Autotone to an image
Copied to your clipboardcurl -X POST \https://image.adobe.io/lrService/autoTone \-H "Authorization: Bearer $token" \-H "x-api-key: $apiKey" \-H "Content-Type: application/json" \-d '{"inputs": {"href": "<SIGNED_GET_URL>","storage": "<storage>"},"outputs": [{"href": "<SIGNED_POST_URL>","type": "<type>","storage": "<storage>"}]}'
This initiates an asynchronous job and returns a request body containing the href to poll for job status.
Copied to your clipboard{"_links": {"self": {"href": "https://image.adobe.io/lrService/status/<:jobId>"}}}
To verify the completion status of the task, utilize the Get Status
API. Refer to this link for an example demonstrating how to check the status.
Autostraighten an image
Copied to your clipboardcurl -X POST \https://image.adobe.io/lrService/autoStraighten \-H "Authorization: Bearer $token" \-H "x-api-key: $apiKey" \-H "Content-Type: application/json" \-d '{"inputs": {"href": "<SIGNED_GET_URL>","storage": "<storage>"},"outputs": [{"href": "<SIGNED_POST_URL>","type": "<type>","storage": "<storage>"}]}'
This initiates an asynchronous job and returns a request body containing the href to poll for job status.
Copied to your clipboard{"_links": {"self": {"href": "https://image.adobe.io/lrService/status/<:jobId>"}}}
To verify the completion status of the task, utilize the Get Status
API. Refer to this link for an example demonstrating how to check the status.
Apply presets to an image
Copied to your clipboardcurl -X POST \https://image.adobe.io/lrService/presets \-H "Authorization: Bearer $token" \-H "x-api-key: $apiKey" \-H "Content-Type: application/json" \-d '{"inputs": {"source": {"href": "<SIGNED_GET_URL>","storage": "<storage>"},"presets": [{"href": "<SIGNED_GET_URL>","storage": "<storage>"},{"href": "<SIGNED_GET_URL>","storage": "<storage>"}]},"outputs": [{"href": "<SIGNED_POST_URL>","type": "<type>","storage": "<storage>"}]}'
This initiates an asynchronous job and returns a request body containing the href to poll for job status.
Copied to your clipboard{"_links": {"self": {"href": "https://image.adobe.io/lrService/status/<:jobId>"}}}
To verify the completion status of the task, utilize the Get Status
API. Refer to this link for an example demonstrating how to check the status.
Apply edits to an image
Copied to your clipboardcurl -X POST \https://image.adobe.io/lrService/edit \-H "Authorization: Bearer $token" \-H "x-api-key: $apiKey" \-H "Content-Type: application/json" \-d '{"inputs": {"source": {"href": "<SIGNED_GET_URL>","storage": "<storage>"}},"options": {"Exposure": -5.00 to 5.00,"Contrast": -100 to 100,"Sharpness": 0 10 150,"WhiteBalance": <"As Shot", "Auto", "Cloudy", "Custom", "Daylight", "Flash", "Fluorescent", "Shade", "Tungsten">"Saturation": -100 to 100,"ColorNoiseReduction": 0 to 100,"NoiseReduction": 0 to 100,"VignetteAmount": -100 to 100,"Vibrance": -100 to 100,"Highlights": -100 to 100,"Shadows": -100 to 100,"Whites": -100 to 100,"Blacks": -100 to 100,"Clarity": -100 to 100,"Dehaze": -100 to +100,"SharpenRadius": 0.5 to 3.0,"SharpenDetail": 0 to 100,"SharpenEdgeMasking": 0 to 100,"Texture": -100 t0 100},"outputs": [{"href": "<SIGNED_POST_URL>","type": "<type>","storage": "<storage>"}]}'
This initiates an asynchronous job and returns a request body containing the href to poll for job status.
Copied to your clipboard{"_links": {"self": {"href": "https://image.adobe.io/lrService/status/<:jobId>"}}}
To verify the completion status of the task, utilize the Get Status
API. Refer to this link for an example demonstrating how to check the status.
Apply xmp to an image
Copied to your clipboardcurl -X POST \https://image.adobe.io/lrService/xmp \-H "Authorization: Bearer $token" \-H "x-api-key: $apiKey" \-H "Content-Type: application/json" \-d '{"inputs": {"href": "<SIGNED_GET_URL>","storage": "<storage>"},"options": {"xmp": "<xmp>","orientation": "<orientation>"},"outputs": [{"href": "<SIGNED_POST_URL>","storage": "<storage>","type": "<type>"}]}'
This initiates an asynchronous job and returns a request body containing the href to poll for job status.
Copied to your clipboard{"_links": {"self": {"href": "https://image.adobe.io/lrService/status/<:jobId>"}}}
To verify the completion status of the task, utilize the Get Status
API. Refer to this link for an example demonstrating how to check the status.
Poll for status and results
Use the JobID to poll on the href that is returned in the response from one of the Lightroom APIs.
- Upon successful job completion, the output file will be available at the specified output href.
- If the job failed due to an error, the
errorDetails
field in the response will contain the details of the failure.
Copied to your clipboardcurl -X GET \https://image.adobe.io/lrService/status/<jobId> \-H "Authorization: Bearer $token" \-H "x-api-key: $apiKey" \-H "Content-Type: application/json" \
And this will return a request body containing the job status for each requested output and eventually either errors or the hrefs to the requested outputs
Copied to your clipboard{"jobId":"<jobId>","created":"2018-01-04T12:57:15.12345:Z","modified":"2018-01-04T12:58:36.12345:Z","outputs":[{"input":"<input_file_href>","status":"succeeded","_links":{"self":{"href":"<output_file_href>","storage":"<storage>"}}}],"_links":{"self":{"href":"https://image.adobe.io/lrService/status/<jobId>"}}}
Triggering an Event from the API's
In order to start receiving the events in your Webhook Application, you will need to pass in your IMS ORG ID in a header: x-gw-ims-org-id: <YOUR_IMS_ORG_ID>
, when you make an API call to initiate a job. Please have a look at the example below that demonstrates the usage of the new header and a sample event received for that job.
Auto tone an image through the Lightroom API
Step 1: Initiate a job to auto tone an image
Copied to your clipboardcurl -X POST \https://image.adobe.io/lrService/autoTone \-H "Authorization: Bearer $token" \-H "Content-Type: application/json" \-H "x-api-key: <YOUR_API_KEY>" \-H 'x-gw-ims-org-id: <YOUR_IMS_ORG_ID>' \-d '{"inputs": {"href": "<SIGNED_GET_URL>","storage": "<storage>"},"outputs": [{"href": "<SIGNED_POST_URL>","type": "<type>","storage": "<storage>"}]}'
This initiates an asynchronous job and returns a request body containing the href to poll for job status.
Copied to your clipboard{"_links": {"self": {"href": "https://image.adobe.io/lrService/status/eb4a9211-eb8a-4e88-b853-b9c08ba47427"}}}
Step 2: Receive the Job's status on the Webhook application when the job is complete
The value in the key body
inside the event JSON contains the result of the job. Here is a sample event received from the job initiated above:
Copied to your clipboard{"event_id": "7b59cc70-88d7-4895-b204-87f5350a0cce","event": {"header": {"msgType": "JOB_COMPLETION_STATUS","msgId": "eb4a9211-eb8a-4e88-b853-b9c08ba47427","imsOrgId": "<YOUR_IMS_ORG_ID>","eventCode": "lightroom-job-status","_pipelineMeta": {"pipelineMessageId": "1586290300876:944289:VA7_A1:149:0"},"_smarts": {"definitionId": "3ee6c9056a9d72fc40e09ddf5fdbb0af752e8e49","runningSmartId": "psmart-yw6wosjksniuuathenny"},"_adobeio": {"imsOrgId": "<YOUR_IMS_ORG_ID>","providerMetadata": "di_event_code","eventCode": "lightroom-job-status"}},"body": {"jobId": "eb4a9211-eb8a-4e88-b853-b9c08ba47427","outputs": [{"input": "<SIGNED_GET_URL>","status": "succeeded","_links": {"self": [{"href": "<SIGNED_POST_URL>","storage": "<storage>"}]}}],"_links": {"self": {"href": "https://image.adobe.io/lrService/status/eb4a9211-eb8a-4e88-b853-b9c08ba47427"}}}}}