Api post requests always returns "Bad Request"

I’ve tried this: (from the command line)

curl -X POST -H "Content-type: application/json" -d '{"apiKey": "1eb7... "userId": "sR9SM..." remId": "GTaycrfRL8ZvsCkCy"}' 'https://api.remnote.io/api/v0/get'

and this: (in python)

import request
# api-endpoint 
URL = "https://www.remnote.io/api/v0/get"
  
# remnote api key
apiKey = "1eb7a..."

# user id 
userId = "sR9S..."

# root rem id = 
remId = "GTa..."

# defining a params dict for the parameters to be sent to the API 
PARAMS = {'apiKey':apiKey, "userId": userId } 
  
# sending get request and saving the response as response object 
r = requests.post(url = URL, json = json.dumps(PARAMS)) 
  
# extracting data in json format 
data = r.json() 

but I always get an html message saying “Bad Request”.

ideas anyone?
thx.

I notice your Python code is sending it to www.remnote.io, not api.remnote.io - can you double check that, please?

1 Like

double-checked, and fixed. thank you!

my python code was wrong in another way too (the following is correct):

PARAMS = {'apiKey':apiKey, "userId": userId, "remId": remId } 
  
# sending get request and saving the response as response object 
r = requests.post(url = URL, data=PARAMS) #json = json.dumps(PARAMS)) 

Joe

1 Like