Sorry to revive an old topic, but I think this would be helpful to note for future searchers. I didn’t find this information elsewhere.
I was running into this same error when POSTing with JSON data, but I fixed it by just adding the api_key and api_usernames to the URL that’s called.