Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

🏠 Back to Blog

HTTP Template

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: http-template-ifconfig-me-
spec:
  entrypoint: main
  templates:
    - name: main
      steps:
        - - name: ifconfig-me
            template: http
            arguments:
              parameters: [{ name: url, value: 'https://ifconfig.me' }]
    - name: http
      inputs:
        parameters:
          - name: url
      http:
        timeoutSeconds: 20 # Default 30
        url: '{{inputs.parameters.url}}'
        method: 'GET' # Default GET
        headers:
          - name: 'Content-Type'
            value: 'application/json'
          - name: 'x-header-name'
            value: 'test-value'
        # Template will succeed if evaluated to true, otherwise will fail
        # Available variables:
        #  request.body: string, the request body
        #  request.headers: map[string][]string, the request headers
        #  request.url: string, the request url
        #  request.method: string, the request method
        #  response.statusCode: int, the response status code
        #  response.body: string, the response body
        #  response.headers: map[string][]string, the response headers
        # successCondition: "response.body contains \"google\""
        # body: "test body" # Change request body