Partially Solved: New record via POSTMAN is created with a null value


#1

Backend based on @tkellen 's endpoints:

http://node-api-pg.herokuapp.com/v1/posts/

As in the screenshot, I specified only title as post15, but it’s creating title with a null value.


#2

I was able to create a new record by:

  1. Specifying the headers with Content-Type and Accept with application/vnd.api+json

  2. Input in Body as raw with the following format:

     {
       "data": {
         "type": "posts",
         "attributes": {
           "title": "post15"
         }
       }
     }
    

Question: Can’t we create a record by specifying a key-value ?


#3

JSON API-compliant APIs expect data submitted to them to be in JSON. However, when you use Postman to submit key-value combinations (with the form-data checkbox), the data submitted to the server is not JSON. Instead, it’s multipart/form-data data. Therefore, it won’t work with any APIs that expect JSON (whether the API is JSON API compliant or not).


#4

Can’t I submit data in JSON format in Postman at all?


#5

Yes, you can do it just like you did earlier. That is, you use the raw option in Postman for the body, and enter the JSON there. Then you set the Content-Type header to application/vnd.api+json