Hi Everyone!
I am busy with a little project where I want a user to provide a prompt request that will be passed to AIP Logic that enriches the prompt with actual data and sends the data enriched prompt to Gemini 3 to create an infographic of the request. But I am stuck at the data connection webhook to Gemini.
In Postman the webhook runs correctly and I get the Base64 encoded string back which is what I expect, but once I go to Foundry the webhook keeps giving me an error 400. I checked everything more than twice now, and I have no idea what I am missing. Here are my inputs:
POST: https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent?key=GeminiSecret
Query Params:
key = GeminiSecret (API key generated from Gemini account)
Headers:
Accept = application/json
Content-Type = application/json
x-goog-api-key = GeminiSecret
Body:
{
“contents”: [
{
“parts”: [
{
“text”: “\u000a* Dashboard/Corporate:\u000a > "@prompt”
}
]
}
]
}
Any help of advice on this topic would be very much appreciated!
Would need a little more info to help debug this:
- Where in Foundry are you testing this - is this in the Webhook UI?
- Can you check the webhook logs? These usually show the exact request being sent, which would reveal any differences from your working Postman call.
- How are you passing your API key? Are you:
Hopefully my questions make sense.
Hi!
Thank you for the questions. Yes that is correct it is within the Webhook UI, the logs constantly had this error: Request to external system failed and returned unsuccessful response code: 400. I set up my REST API with an API Authentication key, with the key added there, and added as a secret that was pulled into the webhook via a query param.
Since posting this I had a discussion with a mentor on this issue, and he had some input to help me fix this issue. We ended up changing the Gemini version to 2.5 instead of 3.1 and removing the API key authentication on the API itself and that seemed to fix the problem. He said he thinks the issue is related to Gemini 3.1 being the newest preview version which may require an additional setting set up that may not be documented yet.
We used the link: POST: https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image:generateContent, and only the two headers: Content-Type = application/json & x-goog-api-key = GeminiSecret, which seemed to fix the whole problem.
Would still love to know for certain if this is the case and if I was just over eager to use the latest Gemini that I shot myself in the foot.