• Documentation of Corr Tool
    • Installation
    • Journey Programming Language
      • Data Types
      • Expressions
      • Templates
      • Statements
        • Rest Operations
        • Service Virtualisation
          • Endpoint Definition
          • Tag Server Example

Endpoint Definition

You can Create Dynamic Endpoints using endpoint definition clauses.

Validity

Valid only in listen block

Syntax

on <rest verb> with url <extractable text template for url>  <match clause> {
    <statements>
    <respond clause>
}

Options

rest verb (Required)

Valid options - get, post, put, patch, delete

extractable text template for url (Required)

Any valid extractable text template matched against url

statements (Optional)

Any number of valid Journey Programming Language Statements

match clause(Optional)

Clause for extracting values from request

Syntax

    matching request <part extraction> <optional second part extraction>

Options

  • part extraction : body <extractable object template> or headers <extractable headers>
  • optional second part extraction: (Optional) and <part extraction>

Example Usage 1

matching request body object {"filed1":field1}

Example Usage 2

matching request headers { "header1":header1 }

Example Usage 3

matching request body object {"filed1":field1} and headers { "header1":header1 }

respond clause: (Required)

Clause for defining response data

Syntax

    respond with <status clause> <body clause>

Options

  • status clause : (Optional) status <expression> and
  • body clause: (Required) body <expression>

Example Usage 1

respond with body object {"message":"Hello"}

Example Usage 2

respond with status 200 and body object {"message":"Hello"}

Example Usage

on post with url text `/<%name%>` matching request body object {"filed1":field1} and headers { "header1":header1 } {
    let count = count + 1
    respond with status 200 and body object {"message":concat("Hello ",name)}
}