Batch

Batch Service

API service used to perform multiple operations in a single HTTP request. Noteworthy features include:

  • Improved performance; network round-trip times are eliminated.
  • Token substitution can be used to chain dependent calls.
  • Each operation executes in an separate transaction.
  • Note: This endpoint intentionally deviates from REST standards and instead follows conventions of RPC.

    Examples:
    Example JSON

    A batch request that invokes two REST endpoints:

     [
         {
             "key": "content",
             "request": {
                 "method": "GET",
                 "endpoint": "https://api/core/v3/contents/1006"
             }
         }, {
             "key": "comments",
             "request": {
                 "method": "GET",
                 "endpoint": "${content:$.resources.comments.ref}"
             }
         }
     ]
    

    The output from this call:

     [
         {
             "id" : "content",
             "href" : "https://api/core/v3/contents/1006",
             "status" : 200,
             "data" : { ... }
         }, {
             "id" : "comments",
             "href" : "https://api.jiveon.com/api/core/v3/contents/1006/comments",
             "status" : 200,
             "data" : { ... }
         }
     ]
    
    Example JSON

    A batch request that expands results using a JSON expression:

     [
         {
             "key": "comments",
             "request": {
                 "method": "GET",
                 "endpoint": "https://api.jiveon.com/api/core/v3/contents/1006/comments"
             }
         }, {
             "key": "outcomes",
             "request": {
                 "method": "GET",
                 "endpoint": "${comments:$.list[*].resources.outcomes.ref}"
             }
         }
     ]
    

    The output from this call:

     [
         {
             "id" : "comments",
             "href" : "https://api.jiveon.com/api/core/v3/contents/1006/comments",
             "status" : 200,
             "data" : { ... }
         }, {
            "id" : "outcomes",
            "status": 207,
            "results" : [
                {
                    "href": "https://api.jiveon.com/api/core/v3/comments/1001/outcomes",
                    "status" : 200,
                    "data": { ... }
                }, {
                    "href": "https://api.jiveon.com/api/core/v3/comments/1002/outcomes",
                    "status": 200,
                    "data": { ... }
                }
            ]
         }
     ]
    

    Execute Batch

    POST /executeBatch

    Executes a BatchRequest, preforming JSON path substitutions as prescribed, invoking REST services and aggregating their results.

    Response status codes appear at several levels of the returned data structure, and represent the status sum at that level.

    Takes:
  • A BatchItem[]. This array is limited to 25 items per call.
  • Retrieves:
  • A BatchResponse[]
  • Return Status:
    HTTP Status CodeDescription
    200 (OK)Request was successful.
    204 (No Content)Expansion of JSON path produced no data.
    405 (Method Not Allowed)If the request specifies an HTTP method that is not supported.
    207 (Multi Status)The JSON path was expanded into multiple individual requests.
    400 (Bad Request)A JSON path was invalid, or the request is otherwise malformed.
    406 (Not Acceptable)Requested service does not return application/json.
    404 (Not Found)Invalid KEY specified in ${KEY:JSON_PATH} expression.
    422 (Unprocessable Entity)The JSON path was valid but resolved to a non-string value.
    429 (Too Many Requests)Too many endpoints requested due to JSON path expansion. The endpoint URLs not loaded will still be listed.