From 99d48d21c5b12532744c27eec4df55539f54564a Mon Sep 17 00:00:00 2001 From: Bharath Krishna <118433150+bharathk08@users.noreply.github.com> Date: Thu, 28 Nov 2024 11:50:54 +0530 Subject: [PATCH] Updated Environments API Document (#545) Updated Environments API doc as per the ticket https://testsigma.atlassian.net/browse/IDEA-2041. --- src/left-nav-title.json | 3 +- src/pages/docs/api/environments.md | 117 ++++++++++++++++------------- 2 files changed, 68 insertions(+), 52 deletions(-) diff --git a/src/left-nav-title.json b/src/left-nav-title.json index cd67a829..091a0adb 100644 --- a/src/left-nav-title.json +++ b/src/left-nav-title.json @@ -689,5 +689,6 @@ "genai-capabilities": {"/docs/genai-capabilities/": "GenAI Capabilities" }, "generate-tdp": {"/docs/genai-capabilities/generate-tdp/": "Generate TDP Using Copilot"}, "smtp-configuration": {"/docs/configuration/smtp-configuration/": "SMTP Configuration"}, - "generate-wda-file": {"/docs/configuration/generate-wda-file/": "Create WDA File" } + "generate-wda-file": {"/docs/configuration/generate-wda-file/": "Create WDA File" }, + "environments": {"/docs/api/environments/": "Manage Environments"} } \ No newline at end of file diff --git a/src/pages/docs/api/environments.md b/src/pages/docs/api/environments.md index 022c6e2f..709cd263 100644 --- a/src/pages/docs/api/environments.md +++ b/src/pages/docs/api/environments.md @@ -1,26 +1,23 @@ --- -title: "Update Environment parameters using REST API" -page_title: "Update Environment parameters using REST API in Testsigma" -metadesc: "How to use the REST API Endpoints available in Testsigma for reading and updating Environment data | Environments API lets you read & update the URL of the AUT dynamically" +title: "Manage Environments Using REST APIs" +page_title: "Manage Environment Parameters Using REST API in Testsigma" +metadesc: "Learn how to use the REST API Endpoints available in Testsigma for reading and updating Environments | Manage Environments Using REST APIs" noindex: false order: 21.2 -page_id: "Update Environment parameters using REST API" +page_id: "Manage Environment Parameters Using REST APIs" warning: false contextual_links: - type: section name: "Contents" - type: link - name: "Get An Environment" + name: "Get an Environment" url: "#get-an-environment" - type: link - name: "Get All Environments" - url: "#get-all-environments" + name: "Update an Environment" + url: "#update-an-environment" - type: link - name: "Update Environment" - url: "#update-environment" -- type: link - name: "Create Environment" - url: "#create-environment" + name: "Create an Environment" + url: "#create-an-environment" --- --- @@ -28,79 +25,97 @@ contextual_links: For some CI/CD pipelines, the URL of the Application Under Test (AUT) changes with every deployment. Manually updating it within the Testsigma App for every build can get tedious at scale. Environments API lets you read and update the URL of the Application under Test (AUT) dynamically after every build in your CI Pipeline. [[info | NOTE:]] -| You need to authenticate these requests with your Testsigma API Key. See [How to generate API Keys.](https://testsigma.com/docs/configuration/api-keys/) +| To authenticate these requests, you must use your Testsigma API Key. See *[How to generate API Keys.](https://testsigma.com/docs/configuration/api-keys/)* --- -## **Get An Environment** -Request Method: **GET** -Endpoint: [https://app.testsigma.com/api/v1/environments/](https://app.testsigma.com/api/v1/environments) +## **Get an Environment** + +This endpoint retrieves details for a specific Environment. + +| **Request Type** | **GET** | +|---|---| +| **Endpoint** | `https://app.testsigma.com/api/v1/environments/` | +|**Response Body (Sample)**|
{
"id": 10,
"name": "Test environment1",
"description": "Test Environment",
"createdById": 2,
"updatedById": 2,
"createdDate": 1732176819137,
"updatedDate": 1732176819137,
"createdAtEpoch": 1732176819137,
"updatedAtEpoch": 1732176819137,
"variables": [
{
"id": 8,
"key": "Url",
"value": "https://google.com",
"isEncrypted": false,
"projectId": 9,
"isDefault": null,
"createdDate": 1732176819179,
"updatedDate": 1732176819179,
"createdAtEpoch": 1732176819179,
"updatedAtEpoch": 1732176819179
}
]
}
| - can be found from the Environment details page URL +The **** can be found in the URL of the Environment details page. Refer to the screenshot below: +![Env ID](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/Env_ID.png) +[[info | **NOTE**:]] +| To retrieve all environments, use this endpoint with the same method.
+|
+| - `https://app.testsigma.com/api/v1/environments` --- -## **Get All Environments** -Request Method: **GET** -Endpoint: https://app.testsigma.com/api/v1/environments +## **Update an Environment** +| **Request Type** | PUT | +|-----------------------|-----| +| **Endpoint** | `https://app.testsigma.com/api/v1/environments/`| +| **Authorization** | Bearer **** | +| **Request Body Type** | JSON | +| **Request Body** |
{
"name": "Test environment1",
"description": "Test Environment",
"createdById": 1,
"updatedById": 3,
"createdDate": 1731915641765,
"updatedDate": 1731915964126,
"createdAtEpoch": 1731915641765,
"updatedAtEpoch": 1731915964126,
"id": 10,
"projectId": 9,
"variables": [
{
"id": "8",
"key": "Url",
"value": "https://youtube.com",
"isEncrypted": false,
"projectId": 9,
"isDefault": null,
"createdDate": 1731915669291,
"updatedDate": 1731915669291,
"createdAtEpoch": 1731915669291,
"updatedAtEpoch": 1731915669291
}
]
}
| ---- -## **Update Environment** -|**Request Type**| PUT | -|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -|**Endpoint**| [https://app.testsigma.com/api/v1/environments/](https://app.testsigma.com/api/v1/environments)
can be found from the Environment details page URL | -|**Authorization**| Bearer
is the same as the Testsigma API Key mentioned above. | -|**Request Body Type**| JSON | -|**Request Body**| {
 "id": 53,
 "name": "newEnvironment",
 "description": null,
 "createdById": 9,
 "updatedById": 9,
 "parameters": {
  "url": "https://travel.testsigma.com/"
 },
 "passwords": []
}| +### **Request Fields:** + +- **name:** This is the environment name. -### **Request/Response fields** +- **description:** This is a description of the environment. -- **id**: The unique identifier for the environment. In this case, it's **53**. +- **createdById:** This identifies the user who created the environment. -- **Name**: The name of the environment. In this case, it's **newEnvironment**. +- **updatedById:** This identifies the user updating the environment. -- **Description**: The description of the environment. In this case, it's **null**. +- **createdDate:** This is the date and time the environment was created. -- **createdById**: The ID of the user who created the environment. In this case, it's **9**. +- **updatedDate:** This is the date and time the environment was last updated. -- **updatedById**: The ID of the user who last updated the environment. In this case, it's also **9**. +- **createdAtEpoch:** This shows the epoch timestamp when the environment was created. -- **Parameters**: An object containing the parameters for the environment. In this case, there is only one parameter with the key **url** and value https://travel.testsigma.com/. +- **updatedAtEpoch:** This shows the epoch timestamp when the environment was last updated. -- **Passwords**: Passwords is a String array containing the names of parameters that need to be encrypted. In this case, it's an empty array. +- **projectId:** Id of the associated project. [[info | NOTE:]] -| Only include the contents that need to be updated and remove the others from the Request Body +| The **Request Body** should include only the fields that are being updated or created. --- -##**Create Environment** -|**Request Type**| POST | -|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -|**Endpoint**| https://app.testsigma.com/api/v1/environments | -|**Authorization**| Bearer
is the same as the Testsigma API Key mentioned above. | -|**Request Body Type**| JSON | -|**Request Body**| {
  "parameters": {
  "url": "https://travel.testsigma.com/"
 },
 "passwords": [],
 "projectId": 191,
 "name": "newEnvironment",
 "description": null,
 "parametersJson": "{\n \\"url\\": \\"https://travel.testsigma.com/\"\n}"
} | +## **Create an Environment** + +| **Request Type** | **POST** | +|----------------------|-----------------| +| **Endpoint** | `https://app.testsigma.com/api/v1/environments` | +| **Authorization** | Bearer **** | +| **Request Body Type** | **JSON** | +| **Request Body** |

{
"name": "Test environment1",
"description": "Test Environment",
"createdById": 1,
"updatedById": 3,
"createdDate": 1731915641765,
"updatedDate": 1731915964126,
"createdAtEpoch": 1731915641765,
"updatedAtEpoch": 1731915964126,
"projectId": 9,
"variables": [
{
"key": "Url",
"value": "https://youtube.com",
"isEncrypted": false,
"projectId": 9,
"isDefault": null,
"createdDate": 1731915669291,
"updatedDate": 1731915669291,
"createdAtEpoch": 1731915669291,
"updatedAtEpoch": 1731915669291
}
]
}
 |
+
+
+
+### **Request Fields:**
+
+- **name:** This is the environment name.
+
+- **description:** This is a description of the environment.
 
+- **createdById:** This identifies the user who created the environment.
 
-### **Request/Response fields**
+- **updatedById:** This identifies the user updating the environment.
 
-- **Parameters**: An object containing the parameters for the environment. In this case, there is only one parameter with the key **url** and value https://travel.testsigma.com/.
+- **createdDate:** This is the date and time the environment was created.
 
-- **Passwords**: Passwords is a String array containing the names of parameters that need to be encrypted. In this case, it's an empty array.
+- **updatedDate:** This is the date and time the environment was last updated.
 
-- **ProjectId**: The ID of the project that the environment belongs to. In this case, it's **191**.
+- **createdAtEpoch:** This shows the epoch timestamp when the environment was created.
 
-- **Name**: The name of the environment. In this case, it's **newEnvironment**.
+- **updatedAtEpoch:** This shows the epoch timestamp when the environment was last updated.
 
-- **Description**: The description of the environment. In this case, it's **null**.
+- **projectId:** Id of the associated project.
 
-- **ParametersJson**: A JSON string representation of the parameters object. It's the same as the **parameters** object.
 
 ---