feedbin / feedbin-api

Feedbin API Documentation
349 stars 26 forks source link

Update entries state from unread to read #58

Closed walidbousseta closed 3 years ago

walidbousseta commented 3 years ago

I'm getting a bad request message status_code 400, here's my code

BASEURL = "https://api.feedbin.com/v2/"
USEAREMAIL = "xxxxxx"
PASSWORD = "xxxxx"

s = requests.Session()
s.auth = (USEAREMAIL, PASSWORD)

r = s.get(BASEURL+'unread_entries.json').json()
data = {"unread_entries":list(ids)}
# {'unread_entries': [3295912461, 3294459305, 3293974343, 3293133656]}

headers = {'Content-Type': 'application/json'}
rp = s.delete(BASEURL+'unread_entries.json', headers=headers, data=data)

rp.status_code
# 400
walidbousseta commented 3 years ago

the solution that worked was rp = s.delete(BASEURL+'unread_entries.json', headers=headers, data=json.dumps(data)) adding the json parsing got it to work json.dumps(data)