php - "Unsupported media type" when PUTing to Apigility with Postman -


i'm building restful api using zend framework 2 , apigility zend framework. testing, use chrome extension postman rest-client.

i can requests , post requests without problems sending form-data without problems.

but when try put, patch or delete request, following error:

{     "type":"http://www.w3.org/protocols/rfc2616/rfc2616-sec10.html",     "title":"unsupported media type",     "status":415,     "detail":"invalid content-type specified" } 

accept whitelist in rest-service-config of apigility:

application/vnd.timber-ms.v1+json, application/hal+json, application/json 

content-type whitelist:

application/vnd.timber-ms.v1+json, application/json 

the content-type of response application/problem+json

what can fix , successfull put/patch requests? problem postman or apigility?

you're getting 415 error of unsupported media type when apigility cannot deserialize data coming client. called out in documentation.

i suspect problem due content-type being sent postman. pay special attention content-type whitelist listed service , make sure contains content-type sending.

for example, if service has has application/json in content-type whitelist , send put/patch postman x-www-form-urlencoded, 415 error of unsupported media type. if change postman send put/patch content-type of application/json , request body contains valid json, apigility should accept request.

you can check content-type postman sending clicking on "preview" button right of "send" button.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -