Skip to content

richa/rails5_with_json_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

  • This application requires Ruby v2.2 and above

  • A few commands to test JSON API responses:

POST localhost:3000/users

Request Payload

{
  "data": {
    "type": "users",
    "attributes": {
		"email": "jane.doe@gmail.com",
		"name": "Jane Doe"
    }
  }
}

Response Payload : 201 Created

{
  "data":{
    "id": "2",
    "type": "users",
    "links":{
      "self": "http://localhost:3000/users/1"
    },
    "attributes":{
      "name": "Jane Doe",
      "email": "jane.doe@gmail.com"
    },
    "relationships":{
      "contacts":{
        "links":{
          "self": "http://localhost:3000/users/1/relationships/contacts",
          "related": "http://localhost:3000/users/1/contacts"
        }
      }
    }
  }
}

GET localhost:3000/users/1

Response Payload : 200 OK

{
  "data":{
    "id": "2",
    "type": "users",
    "links":{
      "self": "http://localhost:3000/users/2"
    },
    "attributes":{
      "name": "Jane Doe",
      "email": "jane.doe@gmail.com"
    },
    "relationships":{
      "contacts":{
        "links":{
          "self": "http://localhost:3000/users/2/relationships/contacts",
          "related": "http://localhost:3000/users/2/contacts"
        }
      }
    }
  }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published