0

I'm getting the error:

"in step "readGcpadmin": {"message":"HTTP body unsupported with: 'GET'","tags":["ValueError"]}"

and I don't know how to solve it, here is the code with the hidden data below:

- readGcpadmin:
call: http.get
args:
    url: https://admin.googleapis.com/admin/directory/v1/users
    #method: get
    headers:
        Authorization: "Bearer [My token]"
        Content-type: "application/json"
    #body:
        #domain: [my domain.page]
    #query:
              
    auth:
      type: OAuth2
      #scope: https://www.googleapis.com/auth/cloud-platform
    #timeout: 20        
result: teste
- returnResult:
    return: ${teste.body}

When I try the terminal it works:

curl \
  'https://admin.googleapis.com/admin/directory/v1/users?domain=MyDomain&key=MyKey' \
  --header 'Authorization: Bearer MyToken' \
  --header 'Accept: application/json' \
  --compressed
jps
  • 20,041
  • 15
  • 75
  • 79
  • Are you getting the “HTTP body unsupported with: 'GET'” error message even after commenting the body tag? Also, you shouldn't add the authorization in the headers, as using “auth” alone is the [documented option](https://cloud.google.com/workflows/docs/authentication#making_authenticated_requests_to_google_apis). The tags inside heathers and auth are not aligned when they should be, also result: teste should be more indented too. – mgoya Dec 28 '20 at 15:54
  • The problem was really with the position of the "auth" field, it was enough to put it in the "Header" directly "auth: OAuth2". In addition, I removed the "Content-type" field. Muito obrigado! – samuelsilvaop Dec 29 '20 at 17:25
  • Glad you found a solution. I recommend you post it as answer so other people with the same issue can find the fix too. – mgoya Dec 30 '20 at 16:12

2 Answers2

0

this is a similar working example, notice the query section which you miss:

readItem:
    call: http.get
    args:
      url: ${"https://storage.googleapis.com/storage/v1/b/"+bucket+"/o"}
      auth:
        type: OAuth2
      query:
        prefix: ${prefix}
        fields: items/name,items/bucket
    result: documentValue
    next: documentFound
Pentium10
  • 204,586
  • 122
  • 423
  • 502
0

The problem was really with the position of the "auth" field, it was enough to put it in the "Header" directly "auth: OAuth2". In addition, I removed the "Content-type" field. Thank you guys!