process.serviceTasks.httpRequest

httpRequest

HTTP Request Service Task allows to perform HTTP(S) calls, and map results of the response back to fields or variables.

properties

  • name

  • retries

  • mapping

  • type

Must be httpRequest

type

string

enum

httpRequest

  • method

Defines the method to use

type

string

enum

GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD

  • url

The URL. Fields, variables or secrets can be used (using double curly braces).

type

string

examples

https://example.com/my-endpoint/{{_vars.myVariable}}

  • query

Key/Value pairs for the query string. Fields, variables or secrets can be used (using double curly braces).

type

object

patternProperties

type

string

  • headers

key/value pairs of the headers to be sent to the request. Fields, variables or secrets can be used (using double curly braces).

type

object

patternProperties

type

string

  • body

The body to be sent in the HTTP Request. Fields, variables or secrets can be used (using double curly braces).

oneOf

It can be a string.

type

string

It can be an object, in which case, it will be sent as form data.

type

object

patternProperties

type

string

additionalProperties

False

allOf

serviceTask _base

In the mapping section, the key can be any of:

  • a field name (e.g. candidate.score)

  • a variable name (e.g. _vars.myVar)

And you can use any of these values (using double braces)

  • body

  • a property of body (e.g. body.data or body.data.a.b.c[1])

  • statusCode

  • headers

  • a specific header (e.g. headers.myHeader)

Examples

# myProcess.yml

serviceTasks:
  calculateScore:
    type: httpRequest
    name: Calculate score
    retries: 3
    method: POST
    url: http://example.com/myEndpoint/{{candidate.email}}
    query:
      code: xyz==
      a: any text
      b: "{{text_candidate.uuid_id}}"
      d: "{{_secrets.mySecret}}"
      e: "{{_vars.initiator.id}}"
      f: A mix of anything {{_vars.initiator.email}} {{_secrets.abc}}
    headers:
      Authorization: Bearer {{_secrets.myToken}} {{text_candidate.uuid_id}}
    body:
      myKey: myValue
      anotherKey: "{{_secrets.mySecret}} {{text_candidate.uuid_id}}"
    mapping:
      myField: Lorem ipsum {{body.data.scoreDescription}}
      candidate.score: "{{body.data.score}}"
      _vars.response: "{{body}}"
      _vars.statusCode: "{{statusCode}}"
      _vars.expireDate: "{{headers.expires}}"