Home » SQL & PL/SQL » SQL & PL/SQL » Consuming Rest API from PL/SQL using UTL_HTTP - body not recognized (11.2.0.4.0)
Consuming Rest API from PL/SQL using UTL_HTTP - body not recognized [message #686414] Thu, 08 September 2022 06:40 Go to next message
skfaheem024
Messages: 5
Registered: September 2022
Junior Member
Hi,

I am new to this forum and consuming Rest API's using PL/SQL. I am trying to consume a rest service from pl/sql, but the server is not able to identify the request. The same request works from postman.. so no problem in the service, something with my pl/sql code i think..

I am trying the free api provided by rapidapi. (link, code and script are attached as i am not able to use links in my first post)
Re: Consuming Rest API from PL/SQL using UTL_HTTP - body not recognized [message #686415 is a reply to message #686414] Thu, 08 September 2022 06:42 Go to previous messageGo to next message
skfaheem024
Messages: 5
Registered: September 2022
Junior Member
The response from server is {"error":{"code":1003,"message":"Parameter q is missing."}}
Re: Consuming Rest API from PL/SQL using UTL_HTTP - body not recognized [message #686416 is a reply to message #686414] Thu, 08 September 2022 09:07 Go to previous messageGo to next message
John Watson
Messages: 8929
Registered: January 2010
Location: Global Village
Senior Member
Welcome to the forum.
Please read the OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.



Can you work up to the problem slowly, one bit at a time? Rather than trying to write the whole procedure in one shot? For example, first the basic connectivity. This works for me:
orclz>
orclz> select utl_http.request('https://weatherapi-com.p.rapidapi.com/ip.json',wallet_path=>'file:c:\tmp\wallet') from dual;

UTL_HTTP.REQUEST('HTTPS://WEATHERAPI-COM.P.RAPIDAPI.COM/IP.JSON',WALLET_PATH=>'FILE:C:\TMP\WALLET')
-----------------------------------------------------------------------------------------------------------------------------------------
{"message":"Invalid API key. Go to https:\/\/docs.rapidapi.com\/docs\/keys for more info."}

orclz>
Re: Consuming Rest API from PL/SQL using UTL_HTTP - body not recognized [message #686420 is a reply to message #686416] Sat, 10 September 2022 01:11 Go to previous messageGo to next message
skfaheem024
Messages: 5
Registered: September 2022
Junior Member
Hi John,

Thank you for your response. Yes this works when i was trying it out and did not pass the apikey as the header.. But once the header was provided, the error was of the parameter q.
Re: Consuming Rest API from PL/SQL using UTL_HTTP - body not recognized [message #689068 is a reply to message #686420] Thu, 07 September 2023 08:54 Go to previous message
Arinaen
Messages: 3
Registered: November 2020
Location: Phoenix
Junior Member
If you're working on b2b API integration and can provide the specific API endpoint and the code you are using to make the request, it will be easier to pinpoint the problem. If you're concerned about sharing sensitive information, you can redact any sensitive credentials or personal data from your code before posting it here. This will help us better assist you with troubleshooting.

[Updated on: Thu, 07 September 2023 08:55]

Report message to a moderator

Previous Topic: Jaro-Winkler similarity for 9i
Next Topic: Update statement with INNER JOIN
Goto Forum:
  


Current Time: Fri Apr 19 15:18:25 CDT 2024