Skip to content

Dynamic Raw JSON Body Variables #978

@matKlju

Description

@matKlju

AS A Service-Module admin
I WANT raw JSON body fields to support preassigned variables
SO THAT request bodies can be populated dynamically at runtime and remain flexible when parameters change (e.g. dates, user input, API responses)

Description

Enable raw JSON body input to accept and resolve preassigned variables.
Service creators must be able to drag variables into the raw JSON editor and place them directly inside JSON values. These variables act as placeholders and are resolved at runtime using the current values available in the service flow.
This allows request bodies to remain reusable and dynamic without requiring manual updates when input values change.

Example (configuration)

*Method: POST https://andmed.stat.ee/api/v1/et/stat/RV021
*Body, RAW-data:
"values" key contains an array of string - predefined variable placeholders ${previous_year}, ${current_year}

{
  "query": [
    {
      "code": "Sugu",
      "selection": {
        "filter": "item",
        "values": [
          "1"
        ]
      }
    },
    {
      "code": "Aasta",
      "selection": {
        "filter": "item",
        "values": [
          ${previous_year},
          ${current_year}
        ]
      }
    }
  ],
  "response": {
    "format": "json-stat2"
  }
}

###Example (runtime result)

{
  "query": [
    {
      "code": "Sugu",
      "selection": {
        "filter": "item",
        "values": [
          "1"
        ]
      }
    },
    {
      "code": "Aasta",
      "selection": {
        "filter": "item",
        "values": [
          "2025",
          "2026"
        ]
      }
    }
  ],
  "response": {
    "format": "json-stat2"
  }
}

###Acceptance Criteria

  • Raw JSON body editor supports inserting preassigned variables

  • Variables can be dragged and dropped into JSON values

  • Variables are visually distinguishable from static text (e.g. pills)

  • All variables are resolved before request execution

  • Variable replacement supports:

    • manually assigned variables
    • assigned user input values
    • previous assigned API response values
    • system-generated values (e.g. date/time)
  • Backward Compatibility

    • Static raw JSON bodies continue to work without changes

Metadata

Metadata

Labels

Projects

Status

Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions