Skip to main content

Running API with Wringr AI

JSON File Format Examples

Below are two examples of the JSON file structure you can upload as parameters.

1. Simple JSON Structure

{
"appUrls": ["url"],
"customjson": ["{json}"],
"name": "Test Parameters"
}
  • The default status code is set to 200.
  • Parameters are, by default, treated as query parameters.

2. JSON Structure with Expected Status and Multiple Parameters

{
"expect_status": 400,
"user_id": {
"value": "22c286cf-d146-4573-980e-e83372715293",
"in": "query"
},
"page": {
"value": "1",
"in": "query"
}
}
  • In this case, expect_status is set to 400, representing the anticipated status code when a required parameter is missing or invalid.
  • Each parameter is defined by a key (e.g., user_id) corresponding to the endpoint's parameter name.
  • The value field specifies the actual value of the parameter.
  • The in field denotes the parameter type (e.g., query). If not specified, it defaults to query.

Here’s an example of how to execute an API with parameters on the Wringr AI platform.

  1. Navigate to the Sessions Page
  2. Click on Upload button
  3. Click the New REST API Test

API

  1. The json is uploaded

API

  1. Navigate to the "Steps" section.
  2. Click on "Security" to configure the security settings.

API

  1. Add Security Credentials
Content-Type : application/json
Authorization : Bearer <token>

API

  1. Expand the /projects/v1/{appid} endpoint, or choose any other relevant endpoint from the list to configure or test its parameters

API

  1. Click on "Add Parameters"

API

  1. You can either upload a JSON file containing the parameters or enter them manually.
{
"expect_status":200,
"params":{
"appUrls": [],
"customjson":{"tags":[]},
"name":"any_new_name_of_app"
}

}

Here is how it looks after uploading

API

  1. Now go Enable selecting individual endpoints and methods and select which endpoints you want to run.

API

  1. Click Generate API Test

API

Execution Process

To execute the steps for testing a project, follow the instructions below for setting up and running the tests in your terminal:

  1. Download the Zip File First, download the zip file containing the project. You can obtain it from the provided link.

  2. Extract the File Once you've downloaded the zip file, extract it to a desired directory on your system.

  3. Navigate to the Project Directory

Open your terminal and navigate to the directory where you've extracted the zip file:

cd /path/to/extracted/folder

Replace /path/to/extracted/folder with the actual path to the extracted project directory.

  1. Install Dependencies

Next, install the required dependencies for the project. Run the following command in your terminal:

npm i

This will install all the necessary dependencies defined in the package.json file.

  1. Run Tests

Once the installation is complete, you can run the tests by executing:

npm test

This will run the tests and output the results in your terminal.

API

  1. Expected Output

After running the tests, you should see the test results, including any pass or fail messages, depending on the outcomes of your tests.

API

Example:


Additional Tips

  • Keep in mind that all JSON must be well-formed and follow strict JSON syntax.
  • When uploading parameters via a file, ensure the file extension and content are valid JSON.
  • Always confirm the Content-Type header is set correctly, especially when sending JSON data.
  • Use the Security section to set global headers so that they don’t have to be repeated for each endpoint.