Internships manager

Internships manager

  • Docs
  • API
  • Tuto
  • Help
  • GitHub

›REST API

Introduction

  • Internships manager API

REST API

  • Businesses
  • Campaigns
  • Files
  • Internships
  • InternshipTypes
  • Mentors
  • Mentoring propositions
  • Statistics
  • Students

Services API

  • Emails
  • Statistics

Mentors

Details of routes to handle mentors

List of all mentors

GET /api/v1/mentors

Params

KeyTypeOptionalDescription
limitNumbernoPage expected (By default 1)
pageNumbernoNumber of row expected (By default 20)

200 - List of mentors

{
    "page": "1",
    "data": [
        {
            "id": 1,
            "firstName": "John",
            "lastName": "Doe",
            "role": "default",
            "email": "john.doe@enib.fr",
            "semester": "S8",
            "createdAt": "2019-09-30T11:24:50.000Z",
            "updatedAt": "2019-09-30T11:24:50.000Z"
        },
    ],
    "length": 1,
    "max": 1
}

204 - Not content

If the API doesn't have any mentors in his database, we return a status 204 - No content

Create a new mentor

POST /api/v1/mentors

Headers

KeyValueDescription
Content-Typeapplication/x-www-form-urlencodedBody encoding

Body

KeyTypeOptionalDescription
firstNameStringnoMentor firstName
lastNameStringnoMentor lastName
roleStringnoMentor role
emailStringnoMentor email
semesterStringnoMentor semester

200 - Created

Return created mentor

{
    "id": 1,
    "firstName": "John",
    "lastName": "Doe",
    "role": "default",
    "email": "john.doe@enib.fr",
    "semester": "S8",
    "createdAt": "2019-09-30T11:24:50.000Z",
    "updatedAt": "2019-09-30T11:24:50.000Z"
}

400 - Bad request

API return Bad Request status with 400 code when request validation fail.

{
  "code": 11103,
  "status": 400,
  "errors": [
    {
      "msg": "Email must be of type string",
      "param": "city",
      "location": "body"
    },
    {
      "msg": "Email must be defined",
      "param": "city",
      "location": "body"
    }
  ],
  "name": "BAD REQUEST"
}

Get a mentor by ID

GET /api/v1/mentors/:id

Paths variables

KeyTypeDescription
idStringMentor ID

200 - Mentor

{
    "id": 1,
    "firstName": "John",
    "lastName": "Doe",
    "role": "default",
    "email": "john.doe@enib.fr",
    "semester": "S8",
    "createdAt": "2019-09-30T11:24:50.000Z",
    "updatedAt": "2019-09-30T11:24:50.000Z"
}

204 - No content

If the API doesn't have any mentor in his database, we return a status 204 - No content

400 - Bad request

API return Bad Request status with 400 code when request validation fail.

{
  "code": 11103,
  "status": 400,
  "errors": [
    {
      "msg": "Identifier must be an integer",
      "param": "city",
      "location": "body"
    },
    {
      "msg": "Identifier must be defined",
      "param": "city",
      "location": "body"
    }
  ],
  "name": "BAD REQUEST"
}

Update a mentor by ID

PUT /api/v1/mentors/:id

Paths variables

KeyTypeDescription
idStringMentor ID

Headers

KeyValueDescription
Content-Typeapplication/x-www-form-urlencodedBody encoding

Body

KeyTypeOptionalDescription
firstNameStringnoMentor firstName
lastNameStringnoMentor lastName
roleStringnoMentor role
emailStringnoMentor email
semesterStringnoMentor semester

200 - Updated mentor

{
    "id": 1,
    "firstName": "John",
    "lastName": "Doe",
    "role": "default",
    "email": "john.doe@enib.fr",
    "semester": "S8",
    "createdAt": "2019-09-30T11:24:50.000Z",
    "updatedAt": "2019-09-30T11:24:50.000Z"
}

204 - No content

If the API doesn't have any mentor in his database, we return a status 204 - No content

400 - Bad request

API return Bad Request status with 400 code when request validation fail.

{
  "code": 11103,
  "status": 400,
  "errors": [
    {
      "msg": "Role must be of type string",
      "param": "city",
      "location": "body"
    }
  ],
  "name": "BAD REQUEST"
}

Remove a mentor by ID

DELETE /api/v1/mentors/:id

Paths variables

KeyTypeDescription
idStringMentor ID

200 - Removed

Return a status 200 without data when delete succeed

204 - No content

If the API doesn't have any mentor in his database, we return a status 204 - No content

Get campaign related to a mentor by giving his ID

GET /api/v1/mentors/:id/campaigns

Paths variables

KeyTypeDescription
idStringMentor ID

Params

KeyTypeOptionalDescription
limitNumbernoPage expected (By default 1)
pageNumbernoNumber of row expected (By default 20)

200 - Campaigns list

{
    "page": "1",
    "data": [
        {
          "id": 1,
          "name": "test",
          "maxProposition": 2,
          "description": "Sed quaerat culpa saepe fuga velit distinctio ea deleniti.",
          "category": {
            "id": 1,
            "label": "Stage ouvrier"
          },
          "semester": "S5",
          "isPublish": false,
          "startAt": 0,
          "endAt": 0,
          "updatedAt": "2019-09-19T22:21:24.365Z",
          "createdAt": "2019-09-19T22:21:24.365Z"
        },
    ],
    "length": 1,
    "max": 1
}

204 - No content

If the API doesn't have any mentor in database link to given ID, we return a status 204 - No content

400 - Bad request

API return Bad Request status with 400 code when request validation fail.

{
  "code": 11103,
  "status": 400,
  "errors": [
    {
      "msg": "Identifier must be an integer",
      "param": "city",
      "location": "body"
    },
    {
      "msg": "Identifier must be defined",
      "param": "city",
      "location": "body"
    }
  ],
  "name": "BAD REQUEST"
}

Link campaign to mentor

GET /api/v1/mentors/:id/campaigns/:campaign_id/link

Paths variables

KeyTypeDescription
idStringMentor ID
campaign_idStringCampaign ID

200 - OK

Data are linked

204 - No content

If the API doesn't have requested campaign or mentor in his database, we return a status 204 - No content

400 - Bad request

API return Bad Request status with 400 code when request validation fail.

{
  "code": 11103,
  "status": 400,
  "errors": [
    {
      "msg": "Identifier must be an integer",
      "param": "city",
      "location": "body"
    },
    {
      "msg": "Identifier must be defined",
      "param": "city",
      "location": "body"
    }
  ],
  "name": "BAD REQUEST"
}
← InternshipTypesMentoring propositions →
  • List of all mentors
    • Params
    • 200 - List of mentors
    • 204 - Not content
  • Create a new mentor
    • Headers
    • Body
    • 200 - Created
    • 400 - Bad request
  • Get a mentor by ID
    • Paths variables
    • 200 - Mentor
    • 204 - No content
    • 400 - Bad request
  • Update a mentor by ID
    • Paths variables
    • Headers
    • Body
    • 200 - Updated mentor
    • 204 - No content
    • 400 - Bad request
  • Remove a mentor by ID
    • Paths variables
    • 200 - Removed
    • 204 - No content
  • Get campaign related to a mentor by giving his ID
    • Paths variables
    • Params
    • 200 - Campaigns list
    • 204 - No content
    • 400 - Bad request
  • Link campaign to mentor
    • Paths variables
    • 200 - OK
    • 204 - No content
    • 400 - Bad request
Copyright © 2019 ENIB