admin管理员组

文章数量:1123093

If in Postman I send a request to using the Postman UI Body selection GraphQL, then Postman sends the request using Content-Type: application-json and in the console I see the Request Body

query: "query {
  boards {
    columns {
      id
      title
      type
    }
  }
}"
variables: ""

Which is really confusing, since that request body isn't valid JSON at all. But the request succeeds.

If I manually set Content-Type: application/graphql and request body

query: "query {
  boards {
    columns {
      id
      title
      type
    }
  }
}"
variables: ""

Then Monday returns

{
    "errors": [
        {
            "message": "'content-type' header must be one of: \"application/json\" or \"application/graphql-response+json\"",
            "extensions": {
                "code": "INVALID_CONTENT_TYPE_HEADER"
            }
        }
    ],
    "account_id": null
}

If I set Content-Type: application/graphql-response+json then Monday returns

{
    "errors": [
        {
            "message": "Invalid GraphQL request",
            "extensions": {
                "details": "failed to deserialize the request body into JSON: expected value at line 1 column 1",
                "code": "INVALID_GRAPHQL_REQUEST"
            }
        }
    ],
    "account_id": 3063938
}

What's going on?

I can escape the GraphQL payload and send it as application/json and that will work, but this makes the payload unreadable, so I'd rather send it as an application/graphql payload.

Sending an application/graphql payload to the Postman api works fine. But a request formatted the same way doesn't work with the Monday api.

How do I get this to work.

本文标签: postmanWhy doesn39t the Monday API support applicationgraphqlStack Overflow