Description
When setting up a GPT Action using an OpenAPI schema that creates a request with URI query strings, it looks like that action tries to pass the values in the body as JSON instead, which causes the request to fail.
Expected behaviour
The GPT action honours the schema and sends the request as specified with the URI query strings intact.
Example
The OpenWeather API uses a simple query string to send requests:
I have a basic OpenAPI schema for this API which works as expected when running in other applications including Postman.
When this OpenAPI schema is entered into a GPT Action and the working auth is set to API Key > Basic, the action succeeds in contacting the API but the request fails with the explanation “It seems there is an issue with accessing the weather data for Seattle due to an invalid API key.”
In the dropdown next to the request it says:
Weather machine sent this info to api . openweathermap . org
To me this reads as the action passing the values in the request body as JSON which is not what the schema specifies. The API can’t receive data from the body so if that’s what’s happening, the failure makes sense.
With no debugging tools or transparency in what’s happening during the request it’s difficult to debug this issue further. The key point here is this OpenAPI schema works when running in other applications, so there’s something about how the action is executed that’s causing this problem.
If you think the values were passed in the body rather than as query params because that’s what the GPT reported to you, I don’t think you can rely on that report.
For example, I found that the GPT would say “Talked to xyz.com” and then show JSON like {“x”: “123”} as if the x var were sent as JSON in the HTTP body. Yet, when I log what my REST endpoint actually saw I can see the request was in fact sent as “xyz.com/endpoint?x=1”. So, I suggest verifying exactly what your REST endpoint is receiving and not relying on this self reporting.
If you still find that the vars are not being sent as query params, it would probably help to post your actual schema.
I really would not trust the self reporting. Logging the request details from the REST endpoint itself is probably the most straightforward way to troubleshoot this.
You were right about the self-reporting and logging (see new comment.) As for pasting the schema inline, it has links in it (of course) so therefore I can’t. I’m guessing the “you can’t post links” thing is a new forum member limitation that will go away after a while.