Google Workflows: Args header seems to be "headers"

617 views Asked by At

From https://cloud.google.com/workflows/docs/reference/syntax#invoking_an_http_endpoint

call: {http.get|http.post|http.request}
    args:
        url: URL_VALUE
        [method: REQUEST_METHOD]
        [header:
            KEY:VALUE
            ...]

It states that to pass the headers the yaml element is called "header". This did not work for me, you get error:

unexpected entry 'header'

When using "headers", it seems to work correctly.

From https://cloud.google.com/workflows/docs/getting-support it suggests using the tag "google-workflows". I could not tag this entry with "google-workflows" as suggested; since the tag doe not exist.

2

There are 2 answers

2
KevinH On BEST ANSWER

Thank you for reporting this error with our documentation.

Indeed you are correct, "headers" seems to be the correct way to utilize this argument when invoking HTTP endpoints via the Workflows API.

I have submitted this issue internally in order to investigate the related public documentation accordingly.

Please note that this product is in beta, and therefore issues like this are expected during this time.

We apologize for the inconvenience.

1
Pentium10 On

The correct way to use that syntax is with headers is like this:

- shortenUrl:
    call: http.post
    args:
        url: https://api-ssl.bitly.com/v4/shorten
        headers:
            Authorization: "Bearer <token>"
            Content-type: "application/json"
        body:
            domain: bit.ly
            long_url: https://cloud.google.com/blog