All Apps and Add-ons

REST API Modular Input: PUT request is not working

thulasiram_yach
Explorer

Hi,

I have been using the REST API Modular input to configure GET requests and am also able to get the data successfully. We have one PUT request that needs to be configured this way, but it's not working.

In the input configuration, I have selected PUT method from the drop-down, provided the request body in JSON format, and also gave required headers in key value pairs. The REST API is getting invoked in the specified interval time, but getting an error response from the API.

The same requestbody along with headers when tried with soapui, we are able to get successful responses in json.

Also, one thing I observed is I didn't see a way to set media type as application/json for the request body.

Can someone who configured PUT/POST requests successfully help me here if I am missing any important parameters?

alt text

alt text

0 Karma
1 Solution

Damien_Dallimor
Ultra Champion

Can you provide specific details about any error messages please.

Search : index=_internal error ExecProcessor rest.py

Can you also provide your actual inputs.conf stanza rather than screenshots.

View solution in original post

0 Karma

Damien_Dallimor
Ultra Champion

Can you provide specific details about any error messages please.

Search : index=_internal error ExecProcessor rest.py

Can you also provide your actual inputs.conf stanza rather than screenshots.

0 Karma

thulasiram_yach
Explorer

Hi Damien,

Thanks for your time in looking into this . Please find the inputs.conf stanza for the PUT request below.

[rest://UPDATEREPAYMENTBANK_MicroService]
auth_type = none
endpoint = https:///lending/v1/loans/031614000037243/
http_header_propertys = X-CLP_XXXX_TRACK_ID=API_HEALTH,X-CLIENT_NAME=API_HEALTH,X-CLP_XXXX_SESSION_ID=API_HEALTH,X-CLP_XXXX_IP_ADDRESS=API_HEALTH
http_method = PUT
index = main
index_error_response_codes = 1
polling_interval = 180
request_payload = { "repay_bank_acct_id":"051616700074926", "lst_updt_by_prcs_nm":"API_HEALTH" }
response_type = text
sequential_mode = 0
sourcetype = _json
streaming_request = 0
disabled = 0

Below are the errors I could see for the search string index=_internal error ExecProcessor rest.py

07-08-2016 10:06:37.012 -0700 ERROR ExecProcessor - message from "python /data/splunk_XXXclp/etc/apps/rest_ta/bin/rest.py" HTTP Request error: 500 Server Error: Internal Server Error

The error message says 500, but it's not true. From SOAP UI, we are able to hit PUT API and get the successful response back. If there is any issue with request, then this error we will receive.

Please let me know if you need more details.

Thank you.

0 Karma

thulasiram_yach
Explorer

Hi Damien ,
I think it resolved for me . I just added Content-Type=application/json as another parameter in the header and it started working for me .

Thank you .

0 Karma
Get Updates on the Splunk Community!

New Dates, New City: Save the Date for .conf25!

Wake up, babe! New .conf25 dates AND location just dropped!! That's right, this year, .conf25 is taking place ...

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud  In today’s fast-paced digital ...

Observability protocols to know about

Observability protocols define the specifications or formats for collecting, encoding, transporting, and ...