Welcome to the Docs!


About

Data types for Typescript


{
  id: number,
  first_name: string,
  last_name: string,
  avatar: string,
  date_of_birth: string,
  age: number,
  gender: string,
  email: string,
  Phone: string,
  location: {
    country: string,
    city: string,
    postal_code: number
  },
  user: {
    username: string,
    password: string,
    userid: string
  },
}
                  

All Users

fetch('https://dummyuser.vercel.app/users')
  .then((response) => response.json())
  .then((json) => console.log(json));
view output

Single User

fetch('https://dummyuser.vercel.app/users/1')
  .then((response) => response.json())
  .then((json) => console.log(json));
view output

Filter Users with single prop

fetch('https://dummyuser.vercel.app/users/q?first_name=Vanni')
  .then((response) => response.json())
  .then((json) => console.log(json));
view output

Filter Users with multiple props

fetch('https://dummyuser.vercel.app/users/q?ageGT=30&ageLT=40')
  .then((response) => response.json())
  .then((json) => console.log(json));
view output

Available Filters

Query Endpoint : 'https://dummyuser.vercel.app/users/q'

Add user POST Method

fetch('https://dummyuser.vercel.app/users', {
  method: 'POST',
  body: JSON.stringify({
    first_name: 'sam',
    last_name: 'leo',
    avatar:'avatar url',
    data_of_birth: '01/01/2000',
    age: 23,
    gender: 'male',
    email: 'samleo@me.com',
    phone: '123456789',
    location:{
      country: 'india',
      city: 'chennai',
      postal_code: 123456
    }
  }),
  headers: {
    'Content-type': 'application/json',
  },
})
  .then((response) => response.json())
  .then((json) => console.log(json));

Note: The resource will appear to be changed on the server but it won't be changed.

Update user PUT Method

fetch('https://dummyuser.vercel.app/users/1', {
  method: 'PUT',
  body: JSON.stringify({
    first_name: 'sam',
    last_name: 'leo',
    avatar:'avatar url',
    data_of_birth: '01/01/2000',
    age: 23,
    gender: 'male',
    email: 'samleo@me.com',
    phone: '123456789',
    location:{
      country: 'india',
      city: 'chennai',
      postal_code: 123456
    }
  }),
  headers: {
    'Content-type': 'application/json',
  },
})
  .then((response) => response.json())
  .then((json) => console.log(json));

Note: The resource will appear to be changed on the server but it won't be changed.

Modify user PATCH Method

fetch('https://dummyuser.vercel.app/users/1', {
  method: 'PATCH',
  body: JSON.stringify({
    data_of_birth: '01/01/1999',
    age: 25,
    phone: '1234512345'
  }),
  headers: {
    'Content-type': 'application/json',
  },
})
  .then((response) => response.json())
  .then((json) => console.log(json));

Note: The resource will appear to be changed on the server but it won't be changed.

Delete user DELETE Method

fetch('https://dummyuser.vercel.app/users/1', {
  method: 'DELETE',
});

Note: The resource will appear to be changed on the server but it won't be changed.