### Directory structure of the Example folder Source: https://github.com/adobedocs/indesign-api-docs/blob/main/SampleScripts/ExtendScript/html5_Export/README.md Shows the layout of the Example directory containing the manifest and JSX files. ```plaintext Example/ ├── manifest.json # Capability manifest file ├── sample.jsx # Main script implementation ├── utils.jsx # Utility functions ├── errors.jsx # Error handling definitions └── json2.jsx # JSON parsing utilities ``` -------------------------------- ### ZIP bundle structure for installation Source: https://github.com/adobedocs/indesign-api-docs/blob/main/SampleScripts/ExtendScript/hyphenation/README.md Illustrates the required ZIP bundle structure for installation. All files must be zipped directly without a parent folder. ```text Archive.zip ├── manifest.json ├── hyphenate.jsx ├── utils.jsx ├── errors.jsx └── json2.jsx ``` -------------------------------- ### Capability manifest.json example Source: https://github.com/adobedocs/indesign-api-docs/blob/main/Capability.md Example of a capability manifest file. It defines the manifest version, capability ID, name, version, host application constraints, and an API entry point. The host app is set to 'indesign' with a minimum version of 17.0.0 and maximum 99.9.9. The entry point specifies a capability script at 'capability.js' using ExtendScript. ```json { "manifestVersion": "1.0.0", "id": "Unique id for the capability", "name": "Name of the capability", "version": "0.0.1", "host": { "app": "indesign", "minVersion": "17.0.0", "maxVersion": "99.9.9" }, "apiEntryPoints": [ { "type": "capability", "path": "capability.js", "language": "extendscript" } ] } ``` -------------------------------- ### Sample Script for Document Processing Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md A script example that parses the input parameters, opens a document, and closes it. ```javascript var input = app.scriptArgs.get('parameters') var allParameters = JSON.parse(input) // Set the working folder. This is the directory within which all the input and output assets are to be managed. var basePath = allParameters["workingFolder"] var documentToOpen = allParameters["params"]["targetDocument"] documentPath = basePath + "\\" + documentToOpen document = app.open(File(documentPath)) document.close() ``` -------------------------------- ### GET /api/v1/capability/status/all/{id} Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md This snippet documents the GET endpoint for retrieving capability status events, including the request example and response structure. ```APIDOC ## [GET] /api/v1/capability/status/all/{id} ### Description Retrieves status events for a specific capability job, optionally filtered by event state. The response includes a paging object with prevUrl and nextUrl to navigate through additional events. ### Method GET ### Endpoint /api/v1/capability/status/all/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the capability job. #### Query Parameters - **state** (string) - Optional - The event state to filter by, e.g., ASSET_UPLOAD_COMPLETED. ### Request Example ``` curl --location --request GET 'https://indesign.adobe.io/api/v1/capability/status/all/ee9f6ee4-ea8c-40d5-a548-f7a0e5a2ca85?state=ASSET_UPLOAD_COMPLETED' \ --header 'Authorization: bearer ' \ --header 'x-api-key: ' ``` ### Response #### Success Response (200) - **events** (array) - List of event objects. - **eventId** (string) - Unique identifier of the event. - **data** (object) - Event data containing sizeInBytes, destination, uploadTimeMillis, and source. - **id** (string) - The capability job identifier. - **state** (string) - The event state. - **timestamp** (number) - The event timestamp. - **paging** (object) - Contains prevUrl and nextUrl for pagination. #### Response Example ```json { "events": [ { "eventId": "ff08253f-2024-4ab3-b52e-67715fbc7f9f", "data": { "sizeInBytes": 7489, "destination": { "type": "S3", "url": "" }, "uploadTimeMillis": 238, "source": "tmp964721/template_rendition2.png" }, "id": "ee9f6ee4-ea8c-40d5-a548-f7a0e5a2ca85", "state": "ASSET_UPLOAD_COMPLETED", "timestamp": 1623913539375 } ], "paging": { "prevUrl": "https://indesign.adobe.io/api/v1/capability/status/all/ee9f6ee4-ea8c-40d5-a548-f7a0e5a2ca85?state=ASSET_UPLOAD_COMPLETED&to=1623913539307", "nextUrl": "https://indesign.adobe.io/api/v1/capability/status/all/ee9f6ee4-ea8c-40d5-a548-f7a0e5a2ca85?state=ASSET_UPLOAD_COMPLETED&from=1623913539376" } } ``` ``` -------------------------------- ### Installation: ZIP archive structure Source: https://github.com/adobedocs/indesign-api-docs/blob/main/SampleScripts/ExtendScript/html5_Export/README.md Shows the required ZIP archive structure for the capability bundle. All files must be zipped directly without a parent folder. ```plaintext Archive.zip ├── manifest.json ├── sample.jsx ├── utils.jsx ├── errors.jsx └── json2.jsx ``` -------------------------------- ### V3 Error Code Example Source: https://github.com/adobedocs/indesign-api-docs/blob/main/Migration_PrivateBeta_to_PublicBeta.md Shows the new error code format using a short string ("resource_not_found") for the same error. ```json { "message": "Job Id ${id} not found", "errorCode": "resource_not_found" } ``` -------------------------------- ### Azure or AWS Input Asset Configuration Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Example of defining an input asset using Azure or AWS storage. The 'source' object specifies the storage type and URL, while 'destination' defines the local path for the downloaded asset. ```json { "source" : { "storageType" : "Azure", "url" : "https://xyz-blob.core.windows.net/Template.indt" }, "destination" : "jobasset/template.indt" } ``` -------------------------------- ### Fetch execution status - YAML request maker Source: https://github.com/adobedocs/indesign-api-docs/blob/main/samples.md YAML configuration for fetching execution status via GET to the status URL. Requires Authorization and X-Api-Key headers. ```yaml defaultMethod: GET url: https://indesign.adobe.io/v3/status/be6aa811-8e0c-4b35-8b8b-e19a49bd4a36 headers: Authorization: Bearer your_token X-Api-Key: your_api_key Content-Type: application/json ``` -------------------------------- ### V1 Error Code Example Source: https://github.com/adobedocs/indesign-api-docs/blob/main/Migration_PrivateBeta_to_PublicBeta.md Shows the old error code format using a numerical value (404) for a job not found error. ```json { "message": "Job Id ${id} not found", "errorCode": 404 } ``` -------------------------------- ### Configure Custom Fonts Asset Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Example JSON structure for providing custom fonts as assets in an InDesign API request. ```json { "assets":[ { "source": { "url":"", "type":"HTTP_GET" }, "destination" : "Cheese_final.indd" }, { "source": { "url":"", "type":"HTTP_GET" }, "destination" : "FontName.otf" } ] } ``` -------------------------------- ### Azure or AWS Output Asset Configuration Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Example of defining an output asset using Azure or AWS storage. The 'destination' object specifies the storage type and URL, while 'source' refers to the internal job asset path. ```json { "destination" : { "type" : "Azure", "url" : "https://xyz-blob.core.windows.net/Template.indt" }, "source" : "jobasset/template.indt" } ``` -------------------------------- ### Get Job Status Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Example cURL request to retrieve the latest status of a job, followed by the JSON response indicating success and output details. ```curl curl --location --request GET 'https://indesign.adobe.io/v3/status/ee9f6ee4-ea8c-40d5-a548-f7a0e5a2ca85' \ --header 'Authorization: bearer ' \ --header 'x-api-key: ' ``` ```json { "jobId": "c1c86ece-90e5-48b0-8469-699ad440602c", "timestamp": "2024-08-29T12:49:37.038Z", "status": "succeeded", "data": { "records": [ { "recordIndex": "1-2", "outputs": [ { "index": "All", "path": [ "tmp405242/range1/template.pdf" ] } ], "warnings": {} } ], "warnings": { "missingLinks": [ "file:/Users/user/Desktop/dataMerge/data.csv" ] } }, "outputs": [ { "destination": { "url": "" }, "source": "tmp405242\\range1\\template.pdf" } ] } ``` -------------------------------- ### GET /v3/status/{executionId} Source: https://github.com/adobedocs/indesign-api-docs/blob/main/samples.md Fetches the execution status of a previously submitted capability execution. ```APIDOC ## GET /v3/status/{executionId} ### Description Fetches the execution status of a previously submitted capability execution. ### Method GET ### Endpoint https://indesign.adobe.io/v3/status/be6aa811-8e0c-4b35-8b8b-e19a49bd4a36 ### Parameters #### Headers - **Authorization** (string) - Required - Bearer token for authentication. - **X-Api-Key** (string) - Required - API key for the Adobe Developer account. - **Content-Type** (string) - Required - Must be `application/json`. ### Request Example ``` curl --location --request GET 'https://indesign.adobe.io/v3/status/be6aa811-8e0c-4b35-8b8b-e19a49bd4a36' \ --header 'Authorization: Bearer ' \ --header 'x-api-key: ' ``` ### Response #### Success Response (200) No response body is documented in the source. ``` -------------------------------- ### Fetch execution status - curl command Source: https://github.com/adobedocs/indesign-api-docs/blob/main/samples.md Curl command to fetch execution status via GET to the status URL. Uses bearer token and API key headers. ```bash curl --location --request GET 'https://indesign.adobe.io/v3/status/be6aa811-8e0c-4b35-8b8b-e19a49bd4a36' \ --header 'Authorization: Bearer ' \ --header 'x-api-key: ' ``` -------------------------------- ### GET /v3/status/{jobId} Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Retrieves the latest status event for a given job ID. The job ID is obtained from the create-rendition response. ```APIDOC ## GET /v3/status/{jobId} ### Description Retrieves the latest status event for a given job ID. The job ID is obtained from the create-rendition response. ### Method GET ### Endpoint https://indesign.adobe.io/v3/status/{jobId} ### Parameters #### Path Parameters - **jobId** (string) - Required - The ID of the job to get the status for. ### Request Example ```curl curl --location --request GET 'https://indesign.adobe.io/v3/status/ee9f6ee4-ea8c-40d5-a548-f7a0e5a2ca85' \ --header 'Authorization: bearer ' \ --header 'x-api-key: ' ``` ### Response #### Success Response (200) - **jobId** (string) - The ID of the job. - **timestamp** (string) - The timestamp of the status event. - **status** (string) - The status of the job (e.g., "succeeded"). - **data** (object) - Contains records with outputs and warnings. - **outputs** (array) - List of output files with destination URLs and source paths. #### Response Example ```json { "jobId": "c1c86ece-90e5-48b0-8469-699ad440602c", "timestamp": "2024-08-29T12:49:37.038Z", "status": "succeeded", "data": { "records": [ { "recordIndex": "1-2", "outputs": [ { "index": "All", "path": ["tmp405242/range1/template.pdf"] } ], "warnings": {} } ], "warnings": { "missingLinks": ["file:/Users/user/Desktop/dataMerge/data.csv"] } }, "outputs": [ { "destination": { "url": "" }, "source": "tmp405242\\range1\\template.pdf" } ] } ``` ``` -------------------------------- ### Trigger Rendition Job Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Example cURL request to trigger a rendition job, followed by the JSON response containing the job status URL and ID. ```curl curl --location --request POST 'https://indesign.adobe.io/api/v3/create-rendition' \ --header 'Authorization: bearer ' \ --header 'x-api-key: ' \ --header 'Content-Type: application/json' \ --data-raw '{ "assets":[ { "source": { "url":, "storageType":"Azure" }, "destination" : "3PageDoc.indd" } ], "params":{ "outputMediaType":"image/png", "targetDocuments": [ "3PageDoc.indd" ], "pageRange": "1-3", "outputFileBaseString": "template_rendition" } }' ``` ```json { "statusUrl": "https://indesign.adobe.io/v3/status/ee9f6ee4-ea8c-40d5-a548-f7a0e5a2ca85", "jobId": "ee9f6ee4-ea8c-40d5-a548-f7a0e5a2ca85" } ``` -------------------------------- ### POST /v3/capability Source: https://github.com/adobedocs/indesign-api-docs/blob/main/samples.md Submits a capability bundle for deployment. The bundle must be a ZIP file containing a manifest.json and the capability script. ```APIDOC ## POST /v3/capability ### Description Submits a capability bundle for deployment. The bundle must be a ZIP file containing a manifest.json and the capability script. ### Method POST ### Endpoint https://indesign.adobe.io/v3/capability ### Parameters #### Headers - **Authorization** (string) - Required - Bearer token for authentication. - **X-Api-Key** (string) - Required - API key for the Adobe Developer account. - **x-gw-ims-org-id** (string) - Required - Adobe Developer organization ID. - **Content-Type** (string) - Required - Must be `application/x-www-form-urlencoded`. #### Request Body - **file** (file) - Required - The capability bundle ZIP file. ### Request Example ``` curl --location --request POST 'https://indesign.adobe.io/v3/capability' \ --header 'Authorization: bearer ' \ --header 'x-api-key: ' \ --header 'x-gw-ims-org-id': ABCDEF123B6CCB7B0A495E2E@AdobeOrg \ --form 'file=@' ``` ### Response #### Success Response (202) - **url** (string) - The URL to execute the capability. - **capability** (string) - The capability name. - **version** (string) - The capability version. #### Response Example ```json { "url": "https://indesign.adobe.io/v3/1f5c78ba4c57a0d3f3877796031de3b4/rendition/jpeg", "capability": "rendition/jpeg", "version": "1.0.13" } ``` ``` -------------------------------- ### Sample manifest.json for capability bundle Source: https://github.com/adobedocs/indesign-api-docs/blob/main/samples.md A typical manifest.json that must be bundled inside the capability zip. It defines the manifest version, unique ID, name, version, host app constraints, and API entry points. ```json { "manifestVersion": "1.0.0", "id": "c1dca2f0-bfe6-4920-ab0b-3b298aa5bfa2", "name": "renditions/jpeg", "version": "1.0.13", "host": { "app": "indesign", "minVersion": "17.0.0", "maxVersion": "99.9.9" }, "apiEntryPoints": [ { "type": "capability", "path": "capability.js", "language": "extendscript" } ] } ``` -------------------------------- ### Sample Input Request Body Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md The initial input request body provided to the system. ```json { "assets": [ { "source": { "storageType": "Azure", "url": "Pre-signed url of document" }, "destination": "doc.indd" } ], "params": { "targetDocument": "doc.indd" } } ``` -------------------------------- ### Configuration to dump application log to file Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md JSON configuration snippet showing how to set generalSettings.appLogs.logsRelativePath to dump the application log into a file. ```json "params": { "targetDocument": "doc.indd", "outputPath": "idmlDoc.idml", "generalSettings": { "appLogs": { "logsRelativePath": "appLog.txt" } } } ``` -------------------------------- ### POST /v3/{capabilityId}/{capabilityName} Source: https://github.com/adobedocs/indesign-api-docs/blob/main/samples.md Executes a previously submitted capability with the provided assets and parameters. ```APIDOC ## POST /v3/{capabilityId}/{capabilityName} ### Description Executes a previously submitted capability with the provided assets and parameters. ### Method POST ### Endpoint https://indesign.adobe.io/v3/1f5c78ba4c57a0d3f3877796031de3b4/rendition/jpeg ### Parameters #### Headers - **Authorization** (string) - Required - Bearer token for authentication. - **X-Api-Key** (string) - Required - API key for the Adobe Developer account. - **Content-Type** (string) - Required - Must be `application/json`. #### Request Body - **assets** (array) - Required - List of assets to be used by the capability. - **source** (object) - Required - Source location of the asset. - **url** (string) - Required - URL of the asset. - **storageType** (string) - Required - Storage type (e.g., AWS). - **destination** (string) - Required - Destination filename for the asset. - **params** (object) - Required - Parameters specific to the capability. - **template** (string) - Required - Template file name. - **ratio** (number) - Required - Ratio value. ### Request Example ``` curl --location --request POST 'https://indesign.adobe.io/v3/1f5c78ba4c57a0d3f3877796031de3b4/rendition/jpeg' \ --header 'Authorization: Bearer ' \ --header 'x-api-key: ' \ --header 'Content-Type: application/json' \ --data-raw '{ "assets": [ { "source": { "url": "https://demo-asset.s3.us-west-1.amazonaws.com/myStorage/template.indt", "storageType": "AWS" }, "destination": "template.indt" }, { "source": { "url": "https://demo-asset.s3.us-west-1.amazonaws.com/myStorage/font.ttf", "storageType": "AWS" }, "destination": "font.ttf" } ], "params": { "template" : "template.indt", "ratio" : 25 } }' ``` ### Response #### Success Response (202) - **id** (string) - The execution ID. - **statusUrls** (string) - URL to fetch the execution status. #### Response Example ```json { "id": "be6aa811-8e0c-4b35-8b8b-e19a49bd4a36", "statusUrls": "https://indesign.adobe.io/v3/status/be6aa811-8e0c-4b35-8b8b-e19a49bd4a36" } ``` ``` -------------------------------- ### Submit a capability - expected response Source: https://github.com/adobedocs/indesign-api-docs/blob/main/samples.md Expected HTTP 202 response after submitting a capability, containing the URL, capability name, and version. ```json { "url": "https://indesign.adobe.io/v3/1f5c78ba4c57a0d3f3877796031de3b4/rendition/jpeg", "capability": "rendition/jpeg", "version": "1.0.13" } ``` -------------------------------- ### Execute a capability - YAML request maker Source: https://github.com/adobedocs/indesign-api-docs/blob/main/samples.md YAML configuration for executing a capability via POST to the capability URL. Includes asset source URLs and parameters like template and ratio. ```yaml defaultMethod: POST url: https://indesign.adobe.io/v3/1f5c78ba4c57a0d3f3877796031de3b4/rendition/jpeg headers: Authorization: Bearer your_token X-Api-Key: your_api_key Content-Type: application/json body: { "assets": [ { "source": { "url": "https://demo-asset.s3.us-west-1.amazonaws.com/myStorage/template.indt", "storageType": "AWS" }, "destination": "template.indt" }, { "source": { "url": "https://demo-asset.s3.us-west-1.amazonaws.com/myStorage/font.ttf", "storageType": "AWS" }, "destination": "font.ttf" } ], "params": { "template" : "template.indt", "ratio" : 25 } } ``` -------------------------------- ### Required JSON parameters for running the script Source: https://github.com/adobedocs/indesign-api-docs/blob/main/SampleScripts/ExtendScript/html5_Export/README.md Provides the JSON parameters to run the script, including an asset source URL and destination, and parameters for target document and output path. ```json { "assets": [ { "source": { "url": "" }, "destination": "sample.indd" } ], "params": { "targetDocument": "sample.indd", "outputPath": "html5Output" } } ``` -------------------------------- ### JavaScript success return object with assets and optional data Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md A sample function to return a success status including an array of assets for upload and an optional data file. ```javascript /* Create an array of assets which is to be uploaded and sent back to the caller. assetPath: Path of the file to be uploaded, relative to the working folder. data: The data in dictionary (object) format to be associated with this asset. (It is optional) This data will be provided to the user with ASSET_UPLOAD_COMPLETED event. */ var assets = [] var assetToBeUploaded = {} assetToBeUploaded.path = assetPath assetToBeUploaded.data = data //this is optional assets.push(assetToBeUploaded) function GetSuccessReturnObj(assets, data) { var obj = {} obj.status = 'SUCCESS' obj.assetsToBeUploaded = assets if (data) { obj.dataURL = WriteToFile(data) } else { obj.dataURL = '' } return JSON.stringify(obj) } ``` -------------------------------- ### Add x-enable-beta header to use InDesign APIs Source: https://github.com/adobedocs/indesign-api-docs/blob/main/FAQs.md Existing Beta partners must include this header in their API requests to continue using InDesign APIs. The header value is 'true'. ```http x-enable-beta: true ``` -------------------------------- ### Directory structure of idmlConversion Source: https://github.com/adobedocs/indesign-api-docs/blob/main/SampleScripts/UXP/idmlConversion/README.md Shows the directory structure of the idmlConversion folder, containing the manifest.json and idml.idjs files. ```text idmlConversion/ ├── manifest.json # Capability manifest file └── idml.idjs # Main script implementation ``` -------------------------------- ### Execute a capability - expected response Source: https://github.com/adobedocs/indesign-api-docs/blob/main/samples.md Expected HTTP 202 response after executing a capability, containing an ID and status URL. ```json { "id": "be6aa811-8e0c-4b35-8b8b-e19a49bd4a36", "statusUrls": "https://indesign.adobe.io/v3/status/be6aa811-8e0c-4b35-8b8b-e19a49bd4a36" } ``` -------------------------------- ### Directory structure of hyphenation capability Source: https://github.com/adobedocs/indesign-api-docs/blob/main/SampleScripts/ExtendScript/hyphenation/README.md Shows the file structure of the hyphenation capability directory, listing the manifest, main script, and helper files. ```text hyphenation/ ├── manifest.json # Capability manifest file ├── hyphenate.jsx # Main script implementation ├── utils.jsx # Utility functions ├── errors.jsx # Error handling definitions └── json2.jsx # JSON parsing utilities ``` -------------------------------- ### Asset format comparison: V1 "type" vs V3 "storageType" Source: https://github.com/adobedocs/indesign-api-docs/blob/main/Migration_PrivateBeta_to_PublicBeta.md Shows the V1 asset format with "type" and the V3 asset format with "storageType". The V3 format replaces the V1 parameter "type" with "storageType", an optional string indicating where the asset is uploaded (Azure/Dropbox/AWS). ```json { "source": { "url": "String which is a pre-sigend URL.", "type": "HTTP_GET", headers: { } } "destination": "String" // unchanged } ``` ```json { "source": { "url": "String which is a pre-sigend URL.", "storageType": Optional string which can be one of "Azure" or "Dropbox or "AWS"" } "destination": string // unchanged } ``` -------------------------------- ### Execute a capability - curl command Source: https://github.com/adobedocs/indesign-api-docs/blob/main/samples.md Curl command to execute a capability via POST to the capability URL. Includes asset source URLs and parameters like template and ratio. ```bash curl --location --request POST 'https://indesign.adobe.io/v3/1f5c78ba4c57a0d3f3877796031de3b4/rendition/jpeg' \ --header 'Authorization: Bearer ' \ --header 'x-api-key: ' \ --header 'Content-Type: application/json' \ --data-raw '{ "assets": [ { "source": { "url": "https://demo-asset.s3.us-west-1.amazonaws.com/myStorage/template.indt", "storageType": "AWS" }, "destination": "template.indt" }, { "source": { "url": "https://demo-asset.s3.us-west-1.amazonaws.com/myStorage/font.ttf", "storageType": "AWS" }, "destination": "font.ttf" } ], "params": { "template" : "template.indt", "ratio" : 25 } }' ``` -------------------------------- ### Submit a capability - YAML request maker Source: https://github.com/adobedocs/indesign-api-docs/blob/main/samples.md YAML configuration for submitting a capability bundle via POST to https://indesign.adobe.io/v3/capability. Requires Authorization, X-Api-Key, x-gw-ims-org-id, and Content-Type headers, with the bundle file as form data. ```yaml defaultMethod: POST url: https://indesign.adobe.io/v3/capability headers: Authorization: Bearer your_token X-Api-Key: your_api_key x-gw-ims-org-id': your_adobe_developer_organization_id Content-Type: application/x-www-form-urlencoded body: file: @ ``` -------------------------------- ### IDML Conversion Script Parameters (JSON) Source: https://github.com/adobedocs/indesign-api-docs/blob/main/SampleScripts/ExtendScript/idmlConversion/README.md Required JSON parameters for running the IDML conversion script. The `assets` array specifies the source URL and destination file, while `params` defines the target document and output path. ```json { "assets": [ { "source": { "url": "" }, "destination": "sample.indd" } ], "params": { "targetDocument": "sample.indd", "outputPath": "converted.idml" } } ``` -------------------------------- ### JavaScript success return object with data file Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md A sample function to return a success status where data is written to a JSON file within the working folder. ```javascript /* Creates an object to be returned when the job is successful. Data is written into a JSON file, which should be created inside a working folder. @param data: The data in dictionary (object) format is to be returned. The object should be stringified before returning. */ function GetSuccessReturnObj(data) { var obj = {} obj.status = 'SUCCESS' obj.assetsToBeUploaded = [] obj.dataURL = WriteToFile(data) return JSON.stringify(obj) } function WriteToFile ( data ) { var newFile var fileName = 'data.json' var filePath = workingFolder + '\\' + fileName newFile = File(filePath) newFile.encoding = 'UTF8' newFile.open('write') newFile.write(JSON.stringify(data)) newFile.close() return filePath } ``` -------------------------------- ### POST /api/v3/create-rendition Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Creates a rendition job for InDesign documents. The request includes assets with pre-signed URLs and parameters for output media type, target documents, page range, and output file base string. ```APIDOC ## POST /api/v3/create-rendition ### Description Creates a rendition job for InDesign documents. The request includes assets with pre-signed URLs and parameters for output media type, target documents, page range, and output file base string. ### Method POST ### Endpoint https://indesign.adobe.io/api/v3/create-rendition ### Parameters #### Request Body - **assets** (array) - Required - List of assets to be used in the rendition. Each asset has a source (with url and type) and a destination. - **params** (object) - Required - Parameters for the rendition, including outputMediaType, targetDocuments, pageRange, and outputFileBaseString. ### Request Example ```json { "assets": [ { "source": { "url": "", "storageType": "Azure" }, "destination": "3PageDoc.indd" } ], "params": { "outputMediaType": "image/png", "targetDocuments": ["3PageDoc.indd"], "pageRange": "1-3", "outputFileBaseString": "template_rendition" } } ``` ### Response #### Success Response (200) - **statusUrl** (string) - URL to get the latest status event of the job. - **jobId** (string) - ID of the job, used to know the status. #### Response Example ```json { "statusUrl": "https://indesign.adobe.io/v3/status/ee9f6ee4-ea8c-40d5-a548-f7a0e5a2ca85", "jobId": "ee9f6ee4-ea8c-40d5-a548-f7a0e5a2ca85" } ``` ``` -------------------------------- ### JavaScript success return object without data or output file Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md A sample function to return a success status when no data or output files are generated. ```javascript /* Creates an object to be returned when the job is successful. The object should be stringified before returning. */ function GetSuccessReturnObj() { var obj = {} obj.status = 'SUCCESS' obj.assetsToBeUploaded = [] obj.dataURL = '' return JSON.stringify(obj) } ``` -------------------------------- ### Default Input JSON Structure (With Arguments) Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md The structure of the 'parameters' argument when the script accepts specific input arguments. ```json { "assets": [ {"path":"doc.indd"}, {"path":"image.pdf"}, ... ], "params": { "arg1": , "arg2": , ... }, "jobID": "0c531425-bc82-43c0-89b7-0e851cd56061", "workingFolder": } ``` -------------------------------- ### Generate access token via cURL Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Use this cURL request to generate an access token using client credentials. The resulting token is valid for 24 hours. ```curl curl -X POST 'https://ims-na1.adobelogin.com/ims/token/v3' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'grant_type=client_credentials&client_id=&client_secret=&scope=openid,AdobeID,indesign_services,creative_cloud,creative_sdk' ``` -------------------------------- ### Capability bundle ZIP structure Source: https://github.com/adobedocs/indesign-api-docs/blob/main/SampleScripts/UXP/idmlConversion/README.md Required ZIP structure for the capability bundle. Files must be zipped directly without a parent folder. ```text Archive.zip ├── manifest.json └── idml.idjs ``` -------------------------------- ### Specify Custom Font Directory Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Configuration to define a specific directory for fonts if they are not located in the default 'Document Fonts' folder. ```json { "params": { "generalSettings": { "fonts": { "fontsDirectories": [ "fontFolder" ] } } } } ``` -------------------------------- ### Log to application log using consoleout and consoleerr Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Redirects log messages to the application's log. The log can be dumped using generalSettings/appLogs/logsRelativePath. ```javascript // The following should come in the application log, which can be dumped using generalSettings/appLogs/logsRelativePath app.consoleout('Logging in app\'s std::out') app.consoleerr('Logging in app\'s std::err') ``` -------------------------------- ### V1 vs V3 status API response (success) Source: https://github.com/adobedocs/indesign-api-docs/blob/main/Migration_PrivateBeta_to_PublicBeta.md Comparison of the V1 and V3 status API responses for a successful job. The V1 response is a paginated list of events with states like ASSETS_DOWNLOAD_STARTED and QUEUED, while the V3 response returns only the current status with fields jobId, timestamp, and status. ```json . ., { "eventId":"EVENT1_ID", "id":"Job ID", "timestamp":"EPOCH TIME", "state":"ASSETS_DOWNLOAD_STARTED" }, { "eventId":"EVENT2_ID", "id":"Job ID", "timestamp":"EPOCH TIME", "state":"QUEUED" }, . . . ``` ```json { "jobId":"JOB_ID", "timestamp":"ISO FORMAT timestamp", "status":"not_started" } ``` -------------------------------- ### Default Input JSON Structure (No Arguments) Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md The structure of the 'parameters' argument sent by the system when no specific script arguments are required. ```json { "assets": [ {"path": "doc.indd"}, {"path": "image.pdf"}, ... ], "params": { }, "jobID": "0c531425-bc82-43c0-89b7-0e851cd56061", "workingFolder": } ``` -------------------------------- ### Optimize Font Directory Usage Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Setting fontsDirectories to an empty array to avoid additional font directory processing when fonts are placed in 'Document Fonts'. ```json { "params": { "generalSettings": { "fonts": { "fontsDirectories": [] } } } } ``` -------------------------------- ### Create PDF Rendition via cURL Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Uses a pre-signed URL and a custom font to create a PDF rendition from an InDesign document. ```curl curl --location --request POST 'https://indesign.adobe.io/v3/create-rendition' \ --header 'Authorization: bearer ' \ --header 'x-api-key: ' \ --header 'Content-Type: application/json' \ --data-raw '{ "assets":[ { "source": { "url":"", "storageType":"Azure" }, "destination" : "Cheese_final.indd" }, { "source": { "url":"", "storageType":"Azure" }, "destination" : "Abelone-FREE.otf" } ], "params":{ "outputMediaType": "image/jpeg", "targetDocuments": [ "Cheese_final.indd" ], "outputFileBaseString": "template_rendition" } }' ``` -------------------------------- ### Script Argument Migration Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Comparison between the old script argument retrieval method and the new method requiring JSON parsing of the 'parameters' argument. ```javascript var arg1 = app.scriptArgs.get('argument1') var arg2 = app.scriptArgs.get('argument2') // Some processing ``` ```javascript var parameters = app.scriptArgs.get('parameters') // parse "parameters" so, that values can be extracted. var arg1 = parameters['argument1'] var arg2 = parameters['argument2'] // Some processing ``` -------------------------------- ### Submit a capability - curl command Source: https://github.com/adobedocs/indesign-api-docs/blob/main/samples.md Curl command to submit a capability bundle via POST to https://indesign.adobe.io/v3/capability. Uses bearer token, API key, and organization ID headers, with the bundle file as form data. ```bash curl --location --request POST 'https://indesign.adobe.io/v3/capability' \ --header 'Authorization: bearer ' --header 'x-api-key: ' \ --header 'x-gw-ims-org-id': ABCDEF123B6CCB7B0A495E2E@AdobeOrg \ --form 'file=@' ``` -------------------------------- ### JSON structure for successful script execution Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md The expected JSON format when a script executes successfully, including status, assets to be uploaded, and a data URL. ```json { "status": "SUCCESS", "assetsToBeUploaded": [ { "path": , "data": } ], "dataURL": } ``` -------------------------------- ### GetFailureReturnObj - Create failure return JSON string Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Creates a JSON string for failed job cases. Takes errorCode and errorString parameters, sets status to 'FAILURE', and returns the JSON stringified object. ```javascript /* Creates json string that is returned in case the job has failed. @param errorCode: Error code detail. @param errorString: Description about the error. @return: json string. */ function GetFailureReturnObj(errorCode, errorString) { var obj = {} obj.status = '‘FAILURE'’ obj.errorCode = errorCode obj.errorString = errorString return JSON.stringify(obj) } ``` -------------------------------- ### Relink custom URIs to assets Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Use this JSON structure to map an uninterpretable custom URI in a document to a new asset path within the working directory. ```json { "params": { "generalSettings": { "links": { "replaceLinks": [ { "targetDocument": "TargetDocument.indd", "mapping": [ { "currentURI": "customScheme:4c189e2d-315e-4fab-a8c2-45690e44d1f0", "newAssetRelativePath": "SomeNewAsset.png" } ] } ] } } } } ``` -------------------------------- ### Check ASSET_UPLOAD_COMPLETED events Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Use this cURL request to filter status events for the ASSET_UPLOAD_COMPLETED state. Replace and with your valid credentials. ```curl curl --location --request GET 'https://indesign.adobe.io/api/v1/capability/status/all/ee9f6ee4-ea8c-40d5-a548-f7a0e5a2ca85?state=ASSET_UPLOAD_COMPLETED' \ --header 'Authorization: bearer ' \ --header 'x-api-key: ' ``` -------------------------------- ### JSON parameters for balanceRaggedLines script Source: https://github.com/adobedocs/indesign-api-docs/blob/main/SampleScripts/ExtendScript/balanceRaggedLines/README.md Required JSON parameters for running the balanceRaggedLines script. The 'labels' array is optional; if omitted, all text frames are affected. The 'balance' value can be 'true' or 'false'. ```json { "assets": [ { "source": { "url": "" }, "destination": "sample.indd" } ], "params": { "targetDocument": "sample.indd", "outputPath": "balanced.indd", "labels": ["MainPara", "Heading"], // Optional: If not provided, affects all text frames "balance": "true" // Can be "true" or "false" } } ``` -------------------------------- ### Configure Adobe font search for documents Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Specify which documents should be scanned for Adobe fonts by including them in the adobeFonts configuration. ```json { "params": { "generalSettings": { "fonts": { "adobeFonts": { "includeDocuments": [ "TargetDocument.indd" ] } } } } } ``` -------------------------------- ### Status API response comparison: V1 vs V3 Source: https://github.com/adobedocs/indesign-api-docs/blob/main/Migration_PrivateBeta_to_PublicBeta.md Compares the V1 status API response with two status URLs and an id, to the V3 response with a single statusUrl and jobId. The V3 status API merges the two V1 status capabilities into one, as pagination is not required unless output count is high. ```json { "statusUrls": { "latest": "https://indesign.adobe.io/api/v1/capability/status/{jobId}", "all": "https://indesign.adobe.io/api/v1/capability/status/all/{jobId}" }, "id": "Guid unique to this asynchronous request" } ``` ```json { "jobId": "Guid unique to this asynchronous request", "statusUrl": "https://indesign.adobe.io/v3/status/{jobId}" } ``` -------------------------------- ### Access InDesign APIs via cURL Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Skeleton request for interacting with InDesign APIs using the generated access token and client ID. ```curl curl --location --request POST \ --header 'Authorization: bearer ' \ --header 'x-api-key: ' \ --header 'Content-Type: application/json' \ --data-raw '{ "assets": [ ... ], "params": { ... }, "outputs": [ ... ] }' ``` -------------------------------- ### JSON structure for failed script execution Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md The expected JSON format when a script execution fails, including status, error code, and error message. ```json { "status": "FAILURE", "errorCode": , "errorString": , } ``` -------------------------------- ### Skip Adobe Fonts Search Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Optimization to skip Adobe fonts search by providing an empty array for includeDocuments. ```json { "params": { "generalSettings": { "fonts": { "adobeFonts": { "includeDocuments": [] } } } } } ``` -------------------------------- ### Required JSON parameters for hyphenation script Source: https://github.com/adobedocs/indesign-api-docs/blob/main/SampleScripts/ExtendScript/hyphenation/README.md JSON parameters required to run the hyphenation script. The labels array is optional; if omitted, all text frames are affected. The hyphenate value can be "true" or "false". ```json { "assets": [ { "source": { "url": "" }, "destination": "sample.indd" } ], "params": { "targetDocument": "sample.indd", "outputPath": "hyphenate.indd", "labels": ["MainPara", "Heading"], // Optional: If not provided, affects all text frames "hyphenate": "true" // Can be "true" or "false" } } ``` -------------------------------- ### Perform DataMerge via cURL Source: https://github.com/adobedocs/indesign-api-docs/blob/main/README.md Creates merged InDesign documents or PDFs by merging data with a template using the merge-data endpoint. ```curl curl --location --request POST 'https://indesign.adobe.io/v3/merge-data' \ --header 'Authorization: bearer ' \ --header 'x-api-key: ' \ --header 'Content-Type: application/json' \ --data-raw '{ "assets": [ { "source": { "url":"", "storageType":"Azure" }, "destination" : "dataMergeTemplate.indd" }, { "source": { "url":"", "storageType":"Azure" }, "destination": "Directory_Names.csv" } ], "params": { "targetDocument": "dataMergeTemplate.indd", "outputMediaType": "application/x-indesign", "outputFolderPath": "outputfolder", "outputFileBaseString" : "merged" "dataSource": "Directory_Names.csv" } "outputs": [ // custom user output { "destination": { "url": "" }, "source": "outputfolder/merged.pdf" } ] }' ```