Hi Guys,
I am trying to integrate with Gemini AI API, encountered with error "404 not found" in run time, tried many ways but not working.
The Google AI is using Post REST API with key, and the request is multi-level of array in JSON format:
{"contents": [{"parts":[{"text": "Tell me a story about a storm"}]}]}
URL: https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=XXXXXXXXXXXXXXX
The test provides good return, but not in runtime.
It's because your url contains ":". It's because of colon only
Add on before request to your api and add these second assignment as "CustomizedRequest.URLPath = Replace(CustomizedRequest.URLPath,"%3A",":")"
It will work afterwards.
Outsystems API call won't recognize ":" and take it as "%3A". So if you replace in On Before Request it will work
Regards
Murali
Hi Murali
Thanks for your feedback.
Just would like to understand, in the Gemini AI API request has no URL.
The method has URL, do yo advise me to change the URL in the method ?
regards
No. Create on Before request for whole API. See the screenshot for reference.
On before request is used to customise api request before calling and on after response is used to customise api response after calling
In on before request you need to change in URL as like I mentioned above
Hi @HO MING STEVEN Tung
Please use this documentation for on before request in rest api.
Simple Customizations - OutSystems 11 Documentation
I herein attached OML for your reference with the rest api call contains on before request. It will work for you.
Please ensure to establish the necessary configurations before initiating the API request. Refer to the provided screenshot for guidance. The 'on before request' function serves to tailor the API request prior to execution, while the 'on after response' function allows customization of the API response post-execution.
In the 'on before request' phase, remember to modify the URL according to the instructions mentioned earlier. This step is crucial for ensuring accurate and customized API interactions.
Request.URLPath = Replace(Request.URLPath,"%3A",":")
Thanks @pramod's feedback, I have been away for weeks, now am back.
I understand what you try to but it seems the GenerativelanguageGoogleapis structure of yours is different from my :
My one :
Yours :
There is HTTPRequest structure in yours which you can change the URL, but my API dose not have this entity.
Hi Pramod's,
I did follow your idea to change the link before request, but the problem still the same :
by the way the input request structure is very much different from the OnBeforeRequest but exactly the same as PostGeminipro. Would that affecting the result ?