Send Docs Feedback

Apigee Test is an Apigee Labs feature. It's available free of charge, functions “as is,” and is not supported. There are no service-level agreements (SLAs) for bug fixes. Get help in the Apigee Community.

Create a Test Case

Resource Summary


Content Type



Apigee Test,



Create a Test Case

In Apigee Test, a Test Case is a collection of API calls that are made in a specified order. Test Cases succeed or fail based on the response criteria you set. A Test Case can be executed automatically by being added to a Probe or manually with a webhook.

There are a lot of configuration possibilities for Test Cases, so before creating a Test Case with this API, you may want to create one in the UI to better understand the concepts.


Also, a good way to figure out how to create the Test Case you want with the API is to first create one in the UI, then run the List Test Cases API to get its ID, then run the Get a Test Case to see its structure. For more information on creating Test Cases with the UI, see Test Cases.

The sample JSON payload below creates a simple Test Case with two API calls (Steps). It includes:

  • JavaScript that sets a variable before each call.
  • A URL that references the JavaScript variable for the host portion of the URL.
  • Success criteria based on an HTTP response code of 2xx (any 200-level response).
  • An variable extracted from the response header. The variable could either be referenced in subsequent calls using ${variable_name}, or its value could be used to assert the response (determine whether the API call was a success or failure).


Resource URL /organizations/{org_name}/testcases

Header Parameters

Name Values Description


Request Body

In the payload, be sure to escape any quotation marks (\") that are to be used literally.

Property Description
statusCode Valid values: 2xx, 200, 201, 202, 3xx, 301, 302, 307, 4xx, 400, 401, 403, 404, 405, 415, 5xx, 500, 502, 503
extractVariables type

Valid values:res_header (Response Header) or jsonpath (Response Body (JSON))

If you want to extract a variable in a response payload for proxy chaining or asserting a response, you can get the variable from the response header or response body using JSONPath.

 "extractVariables": [
            "type": "res_header",
            "name": "Custom name for the variable",
            "value": "Actual name of the header variable (if using the response header) or a JSONPath (if using the response body)."
assertion variable types

ext_var (Extract Variable) or res_header (Response Header)

If you extracted a variable, you can use its value to assert the response (determine whether the call was a success or failure).

"variables": [
              "name": "Name of the custom variable you created",
              "value": "Expected value for the call to be determined a success.",
              "type": "ext_var"

HTTP Basic

OAuth 2.0



Make a request and see the response.

Make a request and see the response.

Make a request and see the response.

Response Error Details

  • HTTP Code
    Error Code
  • 400

    Bad Request

  • 401


  • 403


  • 500

    Internal Server Error


Help or comments?