Configuration APIs

Modified on Mon, Jul 27 at 5:40 PM

Configuration APIs

User Configuration APIs allow you to save and retrieve user-specific configuration values using key-value pairs.

These APIs can be used to manage:

  • Runtime variables
  • User preferences
  • Environment settings
  • Custom configuration values

The APIs can also be configured and used directly in Codeless test execution.

Available APIs

  • Save Config API – Saves or updates a configuration value.
  • Get Config API – Retrieves a previously saved configuration value.

Save Config API

The Save Config API stores a user-specific configuration as a key-value pair.

If the specified key already exists for the user, its value is updated. If the key does not exist, a new configuration entry is created.

Request

Method: POST

Endpoint:

/api/save-config

Body Parameters

ParameterTypeRequiredDescription
user_tokenStringYesAuthentication token of the user.
keyStringYesConfiguration key to save, for example, username, password, environment, or user.
valueStringYesValue associated with the configuration key.

cURL

curl --location 'https://<your-domain>.testgrid.io/api/save-config' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'user_token=<USER_TOKEN>' \
--data-urlencode 'key=<CONFIG_KEY>' \
--data-urlencode 'value=<CONFIG_VALUE>'

Response

{    "success": true,    "message": "Configuration saved successfully."
}

Get Config API

The Get Config API retrieves the value of a previously saved configuration key for the authenticated user.

This API can be used to view saved configuration values and retrieve runtime variables or user-specific settings during test execution.

Request

Method: POST

Endpoint:

/api/get-config

Body Parameters

ParameterTypeRequiredDescription
user_tokenStringYesAuthentication token of the user.
keyStringYesConfiguration key whose value should be retrieved.

cURL

curl --location 'https://<your-domain>.testgrid.io/api/get-config' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'user_token=<USER_TOKEN>' \
--data-urlencode 'key=<CONFIG_KEY>'

Response

{    "success": true,    "key": "user",    "value": "xxx"
}

The saved configuration value can be viewed in the value field of the response.


Using Configuration APIs in Codeless

You can configure and use the Get Config API directly in Codeless to retrieve saved configuration values during test execution.

Steps to Configure the API

  1. Go to the Project section.
  2. Open the required project.
  3. Navigate to the API Request section.
  4. Click Add API Request.
  5. Enter an API Request Name.
  6. Select the required HTTP method, such as POST or GET.
  7. Enter the API URL.

Example:

https://<your-domain>.testgrid.io/api/get-config

  1. Add the required parameters:
    • user_token
    • key
  2. Enter the required values for the parameters.
  3. Click Test API.
  4. The API response is displayed in the Data Preview section.
  5. Select the required Key Path from the response.
  6. Select the required Data Type, such as:
  • String
  • Integer
  • Boolean
  1. Save the API configuration.

View the Saved Configuration Value

After clicking Test API, the API response is displayed in the Data Preview section.

Example:

{    "success": true,    "key": "user",    "value": "xxx"
}

To retrieve the saved configuration value:

  • Select value as the Key Path.
  • Select the appropriate Data Type, such as String.
  • Save the API configuration.

Use the Configuration Value in Codeless

After saving the API configuration, the retrieved value can be used in Codeless test steps.

You can:

  • Use the configured key directly in the required field.
  • Save the API response as a variable.
  • Use the saved variable in subsequent Codeless steps.

The configured key is automatically suggested in Codeless wherever the saved configuration value can be used.

Example

If the configuration key is:

user

and the saved value is:

xxx

You can retrieve the value using the Get Config API and use it in subsequent Codeless steps either by:

  • Using the configured key directly in Type action 
  • Saving the value as a variable and using the variable in later steps.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article