HTTP Request Service Task

Allows to perform HTTP(S) calls, and map results of the response back to fields or variables.

To add an HTTP Request Service task, we need to define it into our process YAML file, and then select it from a service task step using the BPMN Editor.

For example, let’s say we need to find a score, which is calculated by a complex logic that lives in a serverless function.

# myProcess.yml


    name: Calculate score

    # type: should be "httpRequest"
    type: httpRequest

    # retries, optional. Default 3.
    retries: 3

    # method: Defines the method to use
    # Required. Can be any of GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD
    method: POST

    # url: The URL. Can contain fields or variables (using double curly braces)
    # Required

    # query: Key/Value pairs for the query string
    # object, optional

      # the key of this object can be any text
      # the value can be any:
      # - text
      # - field - {{}}
      # - variable - {{}}
      # - secret - {{_secrets.mySecret}}
      # - a mix of them
      a: any text
      b: "{{text_candidate.uuid_id}}"
      d: "{{_secrets.mySecret}}"
      e: "{{}}"
      f: A mix of anything {{}} {{}}

    # headers: key/value pairs of the headers to be sent to the request
    # object, optional

      # the key of this object can be any text
      # the value can be any text, field, variable, secret or a mix of them
      Authorization: Bearer {{_secrets.myToken}}

    # Body: The body to be sent in the HTTP Request.
    # optional, can be either:
    # - a string
    # - an object
    # if body is a string, it can be multiline, and can include any fields, variables, secrets.
    # body: this is the body to be sent {{}}
    # if body is an object, the object properties will be sent as form data

      myKey: myValue
      anotherKey: "{{_secrets.mySecret}} {{candidate.firstName}}"

    # mapping: Configures how the result will be processed
    # object, optional

      # key can be any of:
      # - a field name (e.g. candidate.score)
      # - a variable name (e.g. _vars.myVar)
      # you can use any of these values (using double braces)
      # - body
      # - a property of body (e.g. or[1])
      # - statusCode
      # - headers
      # - a specific header (e.g. headers.myHeader)
      myField: Lorem ipsum {{}}
      candidate.score: "{{}}"
      _vars.response: "{{body}}"
      _vars.statusCode: "{{statusCode}}"
      _vars.expireDate: "{{headers.expires}}"

Then we just need to select the service task from the BPMN Editor.

HTTP Request Service Task

More information in the HTTP Request YAML Reference documentation.