ScriptlessAutomation
  • 👋Welcome to Scriptless Automation
  • Discover More About Automation
    • ⚙️Automation platform intro
    • 💡Advantages of Scriptless Automation
    • 🚀Release Notes
      • 📖Open Code
      • 📕License Code
  • Product tools
    • 📪Pre-request Tools
    • 🔧Project Dependencies
  • Automation Architecture
    • 🎨Flow diagram
  • Get Started
    • 🛠️Start with Automation
    • 📖Open Code Automation
      • 🌏Web Automation
      • ↔️API Automation
    • 🏢Maven Configuration
    • 🗜️Setting Up Maven Project in IntelliJ IDEA
    • 🎛️Scriptless Config
      • 🕸️BrowserConfiguration
        • chrome.properties
      • 👥CommunicationConfiguration
        • SlackConfiguration.properties
      • 📧MailConfiguration
        • gmailCredentials.properties
      • 🛂ReportConfiguration
        • extentReportConfiguration.properties
      • 🕵️TestManagementConfiguration
        • testRail.properties
        • zephyrscale.properties
        • testiny.properties
      • ⚙️testNgConfiguration.properties
    • 🍱TestData Configuration
    • 👨‍💼Gherkin Language and Scriptless Automation Framework
  • Automation Import Notes
    • 🎨Points to Remember
  • Automation Platforms
    • 👾ScriptlessApi Automation
      • 🖊️Introduction
      • 🗜️Api Automation Setup
      • 🔃Supported API Request Types
      • 🪧API Automation Template
      • 📚Example of API Requests
        • ⬇️GET
        • ↕️POST
        • ⤵️PUT
        • ❌DELETE
      • 🎯API Response Validation
      • 👨‍👦API Dependent TestCase
      • 📝Store API Variables
      • 📔API with JSON body
      • 🙋‍♂️Api Wait
      • 🗜️API Schema Validation
      • 🏗️API Tailor-Made coding
      • 👨‍🦯API Support Generator
      • ↘️Api Response Store Objects
      • ✍️API Test Report
      • 🚃Api Response Type Validation
    • 🌐ScriptlessWeb Automation
      • 🖊️Introduction
      • 🗜️Web Automation Setup
      • 🪧Web Automation Template
      • 🧮page_object_locators
      • 📜Web Automation Key Phrases
        • 📃PAGE_NAME
        • ⌛WAIT_TYPE
        • 📜SCROLL_TYPE
        • 👨‍💼ELEMENT_NAME
        • 🏎️ACTIONS
        • ⌨️SEND_KEYS
        • ✔️VALIDATION
        • ✅VALIDATION_TYPE
      • 👨‍👦Web Dependent Test Case
      • 🐒MOCK
      • 🛂AutomationAsserts
      • 🏗️Web Tailor-Made coding
      • 📝Store Web Variables
      • 🤼‍♀️Web & API integration
      • 🖇️Dynamic Strings
      • 🗣️ReadFile Annotation for Custom Code
      • 🖼️Page_Comparison
      • 👨‍💼Gherkin Template for Web Automation
    • 📱Mobile Automation
  • 🪶Automation features
    • 🌲Environment and System Variables
    • 🗝️KeyInitializers
      • Types of KeyInitializers
    • ✍️Reporting
      • Dashboard
      • Category
      • Tests
        • Screenshot Section
    • 👯Parallel Testing
    • 🏗️Tailor-Made Coding
  • ⏩Automation Demo
Powered by GitBook
On this page
  • Overview
  • Storing Values from API Responses
  • Utilising Stored Values in Subsequent Calls
  • Use of Stored Values
  • Conclusion

Was this helpful?

  1. Automation Platforms
  2. ScriptlessApi Automation

Store API Variables

Overview

In scriptless automation, storing values from API responses allows subsequent API calls to utilize these stored values for further operations or validations. This document explains how to configure the storage of response values and how to utilize them in subsequent API calls.

Storing Values from API Responses

Configuration

The CSV template for an API call includes a RESPONSE:STORE_VALUE parameter that determines whether to store a specific value from the API response. The configuration is as follows:

  • RESPONSE:STORE_VALUE: Set to a variable name to store the corresponding value from the given JSON path in the response. Set to NONE to skip storage.

Example

For an API call that creates a new entry (e.g., using POST), the template might look like this:

DEPENDANT_TEST_CASE,NONE,
END_POINT,https://api-generator.retool.com/7kbSLy/data,
METHOD,POST,
PARAMS:KEY,NONE,
PARAMS:VALUE,NONE,
AUTH:KEY,NONE,
AUTH:VALUE,NONE,
HEADERS:KEY,Content-Type,
HEADERS:VALUE,application/json,
BODY:KEY,Column 1,
BODY:VALUE,PrecisionTestAutomation,
RESPONSE:CODE,201,
RESPONSE:JSON_PATH,NONE,'Column 1'
RESPONSE:EXPECTED_VALUE,NONE,PrecisionTestAutomation
RESPONSE:STORE_VALUE,NONE,Name

In this example, the value from 'Column 1' in the response is stored in a variable named Name.

Utilising Stored Values in Subsequent Calls

Usage Template

Stored values can be utilized in subsequent API calls by referencing them in the template. The reference is made using a specific syntax, often prefixed with an identifier like ApiGlobalVariables.

Example

For a subsequent API call that retrieves data (e.g., using GET), the template might reference the stored variable as follows:

DEPENDANT_TEST_CASE,POST,
END_POINT,https://api-generator.retool.com/7kbSLy/data/1,
METHOD,GET,
...
RESPONSE:CODE,200,
RESPONSE:JSON_PATH,NONE,id,'Column 1'
RESPONSE:EXPECTED_VALUE,NONE,1,ApiGlobalVariables:Name
RESPONSE:STORE_VALUE,NONE,NONE,NONE

In this example, the template references ApiGlobalVariables:Name, which utilizes the value stored in the variable Name from the previous API response.

Use of Stored Values

In addition to the RESPONSE:EXPECTED_VALUE, stored values can be utilized in various other parts of the API call template. Stored values can be used in the following components:

  1. END_POINT: Incorporate stored variables into the endpoint URL to dynamically change API endpoints based on previous responses.

    END_POINT,https://api-generator.retool.com/7kbSLy/data/ApiGlobalVariables:XXX,
  2. PARAMS:VALUE: Use stored variables as parameter values in the API request.

    PARAMS:VALUE,ApiGlobalVariables:XXX,
  3. AUTH:VALUE: Apply stored variables in authentication fields, useful for dynamic authentication scenarios.

    AUTH:VALUE,ApiGlobalVariables:XXX,
  4. HEADERS:VALUE: Include stored variables in request headers, such as dynamically generated tokens or session data.

    HEADERS:VALUE,ApiGlobalVariables:XXX,
  5. BODY:VALUE: Insert stored variables in the request body, allowing the body content to change based on previous responses.

    BODY:VALUE,ApiGlobalVariables:XXX,

Conclusion

Storing and utilising values from API responses is a powerful feature in scriptless automation, enabling dynamic data handling and interdependent API testing. By configuring the RESPONSE:STORE_VALUE appropriately and referencing stored values using a designated syntax, testers can create flexible and efficient automated API tests. This approach is particularly useful in scenarios where the output of one API call is a prerequisite for subsequent calls.

PreviousAPI Dependent TestCaseNextAPI with JSON body

Last updated 8 months ago

Was this helpful?

👾
📝