jsonRequest

Syntax

app.jsonRequest(jsonUrl, jsonRequest);

Parameters

jsonUrl string

The path to the Studio server URL which can receive and respond to requests done in JSON object string format.

jsonRequest string

The request to post to the above URL in JSON object string format.

Return value string

A string containing the complete and total server response.

Description

The jsonRequest() method posts a JSON object string as a request to a Studio Server URL in order to receive a response in JSON object string format.

Notes

In Studio for InDesign and InCopy versions earlier than 21.0 (Adobe 2026), the HTTP header Content-Type is incorrectly set to application/x-www-form-urlencoded. According to the standards for communication in json format, the Content-Type should be application/json. Since Studio for InDesign and InCopy for Adobe 2026 (21.0) the Content-Type HTTP header is therefore set to application/json.

Examples

Full working script examples for QueryObjects, DeleteObject, GetPublicationDate: jsonRequest-samples.zip

QueryObject code snippet

#include "json2.jsxinc" // Included in the jsonRequest-samples.zip.

var serverUrl =
  "https://studio.enterprise.woodwing.net/server/index.php?protocol=JSON";

// Construct the request.
var requestObject = {
  method: "QueryObjects",
  id: "1",
  params: [
    {
      Params: [
        {
          Property: "Publication",
          Value: "WW News",
          Operation: "=",
          __classname__: "QueryParam",
        },
        {
          Property: "Type",
          Value: "Image",
          Operation: "=",
          __classname__: "QueryParam",
        },
        {
          Property: "Name",
          Value: "Beachball",
          Operation: "contains",
          __classname__: "QueryParam",
        },
      ],
      FirstEntry: 1,
      MinimalProps: ["ID", "Name", "Type", "Category", "Issues", "State"],
      Order: [
        {
          Property: "Name",
          Direction: true,
          __classname__: "QueryOrder",
        },
      ],
      Ticket: app.entSession.activeTicket,
    },
  ],
  jsonrpc: "2.0",
};

// Execute the request and get the response.
var response = JSON.parse(
  app.jsonRequest(serverUrl, JSON.stringify(requestObject))
);

// Get the object with the requested information.
var requestedObject = response.result.Rows[0];

// Get the individual values.
var objectType = requestedObject[1];    // Images
var objectName = requestedObject[2];    // Beachball
var brandName = requestedObject[18];    // WW News

Supported versions

Adobe Version Supported
2023
2024
2025
2026