Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I am having trouble designing a REST api call using requests to hit a Kinetica DB instance to confirm it is working

Here is the code I tried:

import requests
test = requests.request("GET",'https://mycoolurl.host/admin/verifydb')
print(test.json())

It results in a 400 error.

like image 454
jamescampbell Avatar asked Nov 21 '25 05:11

jamescampbell


1 Answers

It turns out that, according to Kinetica's documentation, every call is a POST call even if you are not sending data into the system and only expecting data coming back. Thus, this version modified to a POST, from above works, and results in a 200 and json data back from the server:

test = requests.request("POST",'https://mycoolurl.host/admin/verifydb', json={'options': {}})
print(test.json())
like image 109
jamescampbell Avatar answered Nov 23 '25 18:11

jamescampbell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!