Content-Type Request Header to be Enforced in Storage API
It is our desire to accept only JSON as the request body for all Keboola APIs in the future. We will roll out this change gradually over the next few months.
In the following weeks, we'll change the way we treat the Content-Type
header. Note: This only affects you if you use our Storage API directly, not via our UI or CLI.
Our plan is to support application/json
and phase out application/x-www-form-urlencoded
for all endpoints in the future. To get there, we'll start to take the Content-Type
header, up until now ignored, into account when handling the requests.
Currently the Content-Type
header is not being taken into account, and content type is defined by the API documentation. Most Storage API endpoints are defined as accepting only Content-Type:application/x-www-form-urlencoded
. An example of this is the Create Configuration endpoint. An exception to the rule is, for instance, the newly added Branch Metadata endpoint that already accepts only JSON in the request body.
To ensure that the change is rolled out seemlessly, we'll separate it into multiple steps.
As the first step, in the following weeks, we'll treat the request body only as JSON if the Content-Type
is application/json
. Anything else or anything missing a header will be processed as application/x-www-form-urlencoded
. We'll roll this change out on an endpoint-by-endpoint basis, but we'll publish another post when all Storage API endpoints support JSON in the request body and you can start using it. For the time being, just make sure you don't send the Content-Type: application/json
header by accident.
In the upcoming months, after we become confident that there are no active cases of a missing or misaligned Content-Type
header, we'll enforce the header completely (by making a missing or incorrect header an error).
Finally, we'll remove the support for application/x-www-form-urlencoded
completely, but right now that's far in the future.