NAV Navbar
javascript

Introduction

This API allows for the creation of a student and the ability to query for their likes and dislikes. You can also delete a student, edit their personal details and their likes and dislikes.

Person endpoints

Get all people

This endpoint will query for all people in the system. It limits to 50 results at one time and will allow for pagination.

The JSON returned will look like this:

[
  {
    "person_id": 3,
    "first_name": "test",
    "last_name": "hello",
    "cohort": "il1",
    "created_at": "2020-01-21T18:33:09.218Z",
    "updated_at": null
  }
]

HTTP Request

GET https://ios-api.devmountain.com/api/people

Query Parameters

Parameter Required Description
offset false The value passed will dictate how much to offset the requested people resources by.

Get person by id

This endpoint will get the person details and their likes / dislikes.

The JSON returned will look like this:

[
  {
    "likes": [
      {
        "likes_id": 2,
        "likes_text": "hello",
        "person_likes_fk": 3,
        "created_at": "2020-01-23T22:55:03.636Z",
        "updated_at": null
      }
    ],
    "dislikes": [
      {
        "dislikes_id": 1,
        "dislikes_text": "hello",
        "person_dislikes_fk": 3,
        "created_at": "2020-01-23T22:58:11.720Z",
        "updated_at": null
      }
    ],
    "person_id": 3,
    "first_name": "test",
    "last_name": "hello",
    "cohort": "il1",
    "created_at": "2020-01-21T18:33:09.218Z",
    "updated_at": null
  }
]

HTTP Request

GET https://ios-api.devmountain.com/api/person/:person_id

URL Parameters

Parameter Required Description
person_id true The id of the person whose details to retrieve.

Create person

This endpoint allows you to create a person resource.

The JSON returned will look like this:

[
  {
    "person_id": 4,
    "first_name": "foo",
    "last_name": "bar",
    "cohort": "il1",
    "created_at": "2020-01-23T23:04:16.896Z",
    "updated_at": null
  }
]

HTTP Request

POST https://ios-api.devmountain.com/api/person

Body values

Key Required Value
first_name true string - value of first name
last_name true string - value of last name
cohort true string - value of persons cohort

Delete person

This endpoint allows you to delete a person.

HTTP Request

DELETE https://ios-api.devmountain.com/api/person/:person_id

URL Parameters

Parameter Required Description
person_id true The id of the person to delete.

Like endpoints

Create like

This endpoint allows you to create a like for a given person.

The JSON returned will look like this:

[
  {
    "likes_id": 3,
    "likes_text": "hello",
    "person_likes_fk": 3,
    "created_at": "2020-01-23T23:23:02.812Z",
    "updated_at": null
  }
]

HTTP Request

POST https://ios-api.devmountain.com/api/likes/:person_id

URL Parameters

Parameter Required Description
person_id true The id of the person to create a like for.

Body values

Key Required Value
interest true string - value of the person's like

Update like

This endpoint allows you to update an existing like by it's id.

The JSON returned will look like this:

[
  {
    "likes_id": 3,
    "likes_text": "hi",
    "person_likes_fk": 3,
    "created_at": "2020-01-23T23:23:02.812Z",
    "updated_at": "2020-01-23T23:25:20.000Z"
  }
]

HTTP Request

PUT https://ios-api.devmountain.com/api/likes/:like_id

URL Parameters

Parameter Required Description
like_id true The id of the like to update.

Body values

Key Required Value
new_interest true string - value of the new interest to update to

Delete like

This endpoint allows you to delete an existing like by it's id.

HTTP Request

DELETE https://ios-api.devmountain.com/api/likes/:like_id

URL Parameters

Parameter Required Description
like_id true The id of the like to delete.

Dislike endpoints

Create dislike

This endpoint allows you to create a dislike for a given person.

The JSON returned will look like this:

[
  {
    "dislikes_id": 2,
    "dislikes_text": "hello",
    "person_dislikes_fk": 3,
    "created_at": "2020-01-23T23:28:46.856Z",
    "updated_at": null
  }
]

HTTP Request

POST https://ios-api.devmountain.com/api/dislikes/:person_id

URL Parameters

Parameter Required Description
person_id true The id of the person to create a dislike for.

Body values

Key Required Value
interest true string - value of the person's dislike

Update dislike

This endpoint allows you to update an existing dislike by it's id.

The JSON returned will look like this:

[
  {
    "dislikes_id": 3,
    "dislikes_text": "htesti",
    "person_dislikes_fk": 3,
    "created_at": "2020-01-23T23:29:44.986Z",
    "updated_at": "2020-01-23T23:29:44.000Z"
  }
]

HTTP Request

PUT https://ios-api.devmountain.com/api/dislikes/:dislike_id

URL Parameters

Parameter Required Description
dislike_id true The id of the dislike to update.

Body values

Key Required Value
new_interest true string - value of the new dislike to update to

Delete dislike

This endpoint allows you to delete an existing dislike by it's id.

HTTP Request

DELETE https://ios-api.devmountain.com/api/dislikes/:dislike_id

URL Parameters

Parameter Required Description
dislike_id true The id of the dislike to delete.

Errors

This API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid or missing required values.
500 Internal Server Error -- We had a problem with our server. Try again later.