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

Campaigns

Details of routes to handle campaigns

List of all campaigns

GET /api/v1/campaigns

Params

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

200 - List of campaigns

{
    "page": "1",
    "data": [
        {
            "id": 1,
            "maxProposition": 2,
            "description": "Sed quaerat culpa saepe fuga velit distinctio ea deleniti.",
            "category": {
              "id": 1,
              "label": "Stage ouvrier"
            },
            "name": "test",
            "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 - Not content

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

Create a new campaign

POST /api/v1/campaigns

This endpoint is more complexe than other, when you create a new campaign and you set isPublish to true, you will trigger the created setup and the API will return 202 - Accepted.

To listen to advencement of your trigger, you can setup a socket connection and listen to following events:

  • campaign_create_start Start of processing (email send, mentor and internships link)
  • campaign_create_step Step on process
  • campaign_create_end End of process
  • campaign_create_error Error during process

Headers

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

Body

KeyTypeOptionalDescription
nameStringnoCampaign name
maxPropositionIntegernoCampaign max proposition
descriptionStringnoCampaign description
category_idStringnoCampaign category identifier
semesterStringnoCampaign semester
isPublishBooleannoCampaign is publish
startAtIntegernoCampaign start date
endAtIntegernoCampaign end date

200 - Created

Return created campaign

{
  "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"
}

400 - Bad request

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

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

Get a campaign by ID

GET /api/v1/campaigns/:id

Paths variables

KeyTypeDescription
idStringCampaign ID

200 - Campaign

{
  "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,
  "propositions": [],
  "updatedAt": "2019-09-19T22:21:24.365Z",
  "createdAt": "2019-09-19T22:21:24.365Z"
}

204 - No content

If the API doesn't have any campaign 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 campaign by ID

PUT /api/v1/campaigns/:id

Paths variables

KeyTypeDescription
idStringCampaign ID

Headers

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

Body

KeyTypeOptionalDescription
nameStringyesCampaign name
maxPropositionIntegeryesCampaign max proposition
descriptionStringyesCampaign description
category_idStringyesCampaign category identifier
semesterStringyesCampaign semester
isPublishBooleannoCampaign is publish
startAtIntegeryesCampaign start date
endAtIntegeryesCampaign end date

200 - Updated campaign

{
  "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"
}

204 - No content

If the API doesn't have any campaign 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": "Name must be of type string",
      "param": "city",
      "location": "body"
    }
  ],
  "name": "BAD REQUEST"
}

Remove a campaign by ID

DELETE /api/v1/campaigns/:id

Paths variables

KeyTypeDescription
idStringCampaign ID

200 - Removed

Return a status 200 without data when delete succeed

204 - No content

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

Get propositions related to a campaign by giving his ID

GET /api/v1/campaigns/:id/mentoringPropositions

Paths variables

KeyTypeDescription
idStringCampaign ID

200 - Propositions list

{
    "page": "1",
    "data": [
        {
            "id": 1,
            "comment": "Atque officia consectetur. Eum molestiae rerum qui et. Nostrum fuga molestiae voluptate. Eius omnis nihil non eveniet sed ut. Voluptate provident et voluptate provident illo voluptatem enim ea et. Voluptatem qui reiciendis molestiae rerum blanditiis rem. Ut qui dolor nostrum consequatur accusantium ex esse mollitia atque.",
            "createdAt": "2019-10-13T16:21:25.000Z",
            "updatedAt": "2019-10-13T16:21:25.000Z"
        },
    ],
    "length": 1,
    "max": 1
}

204 - No content

If the API doesn't have any campaign 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"
}

Link proposition to campaign

GET /api/v1/campaigns/:id/mentoringPropositions/:mentoring_proposition_id/link

Paths variables

KeyTypeDescription
idStringCampaign ID
mentoring_proposition_idStringProposition ID

200 - OK

Ok appears on two occasions

  • If entries have been linked
  • If propositions haven't been found
OK

204 - No content

If the API doesn't have any campaign 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"
}

Get availables internships related to a campaign by giving his ID

GET /api/v1/campaigns/:id/availableInternships

Paths variables

KeyTypeDescription
idStringCampaign ID

Params

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

200 - Availables internships list

{
    "page": "1",
    "data": [
      {
          "id": 1,
          "subject": "Sed quaerat culpa saepe fuga velit distinctio ea deleniti.",
          "description": "Atque officia consectetur. Eum molestiae rerum qui et. Nostrum fuga molestiae voluptate. Eius omnis nihil non eveniet sed ut. Voluptate provident et voluptate provident illo voluptatem enim ea et. Voluptatem qui reiciendis molestiae rerum blanditiis rem. Ut qui dolor nostrum consequatur accusantium ex esse mollitia atque.",
          "country": "Russian Federation",
          "city": "New Rocky",
          "postalCode": "30636-9003",
          "address": "15486 Genoveva Isle",
          "additional": "Suite 755",
          "isInternshipAbroad": false,
          "isValidated": false,
          "isProposition": true,
          "isPublish": false,
          "state": "waiting",
          "publishAt": "2019-10-13T16:21:25.000Z",
          "createdAt": "2019-10-13T16:21:25.000Z",
          "updatedAt": "2019-10-13T16:21:25.000Z"
      },
    ],
    "length": 1,
    "max": 1
}

204 - No content

If the API doesn't have any campaign 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"
}

Link available internship to campaign

GET /api/v1/campaigns/:id/availableInternships/:internship_id/link

Paths variables

KeyTypeDescription
idStringCampaign ID
internship_idStringInternship ID

200 - OK

Ok appears on two occasions

  • If entries have been linked
  • If internship haven't been found
OK

204 - No content

If the API doesn't have any campaign 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"
}

Get validated internships related to a campaign by giving his ID

GET /api/v1/campaigns/:id/validatedInternships

Paths variables

KeyTypeDescription
idStringCampaign ID

Params

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

200 - Validated internships list

{
    "page": "1",
    "data": [
        {
            "id": 1,
            "subject": "Sed quaerat culpa saepe fuga velit distinctio ea deleniti.",
            "description": "Atque officia consectetur. Eum molestiae rerum qui et. Nostrum fuga molestiae voluptate. Eius omnis nihil non eveniet sed ut. Voluptate provident et voluptate provident illo voluptatem enim ea et. Voluptatem qui reiciendis molestiae rerum blanditiis rem. Ut qui dolor nostrum consequatur accusantium ex esse mollitia atque.",
            "country": "Russian Federation",
            "city": "New Rocky",
            "postalCode": "30636-9003",
            "address": "15486 Genoveva Isle",
            "additional": "Suite 755",
            "isInternshipAbroad": false,
            "isValidated": false,
            "isProposition": true,
            "isPublish": false,
            "state": "waiting",
            "publishAt": "2019-10-13T16:21:25.000Z",
            "createdAt": "2019-10-13T16:21:25.000Z",
            "updatedAt": "2019-10-13T16:21:25.000Z"
        },
    ],
    "length": 1,
    "max": 1
}

204 - No content

If the API doesn't have any campaign 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"
}

Link available internship to campaign

GET /api/v1/campaigns/:id/validatedInternships/:internship_id/link

Paths variables

KeyTypeDescription
idStringCampaign ID
internship_idStringInternship ID

200 - OK

Ok appears on two occasions

  • If entries have been linked
  • If internship haven't been found
OK

204 - No content

If the API doesn't have any campaign 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"
}

Get internships related to a campaign by giving his ID

GET /api/v1/campaigns/:id/internships

Paths variables

KeyTypeDescription
idStringCampaign ID

Params

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

200 - Internships list

{
    "page": "1",
    "data": [
        {
            "id": 1,
            "subject": "Sed quaerat culpa saepe fuga velit distinctio ea deleniti.",
            "description": "Atque officia consectetur. Eum molestiae rerum qui et. Nostrum fuga molestiae voluptate. Eius omnis nihil non eveniet sed ut. Voluptate provident et voluptate provident illo voluptatem enim ea et. Voluptatem qui reiciendis molestiae rerum blanditiis rem. Ut qui dolor nostrum consequatur accusantium ex esse mollitia atque.",
            "country": "Russian Federation",
            "city": "New Rocky",
            "postalCode": "30636-9003",
            "address": "15486 Genoveva Isle",
            "additional": "Suite 755",
            "isInternshipAbroad": false,
            "isValidated": false,
            "isProposition": true,
            "isPublish": false,
            "state": "waiting",
            "publishAt": "2019-10-13T16:21:25.000Z",
            "createdAt": "2019-10-13T16:21:25.000Z",
            "updatedAt": "2019-10-13T16:21:25.000Z"
        },
    ],
    "length": 1,
    "max": 1
}

204 - No content

If the API doesn't have any campaign 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"
}

Get internships types related to a campaign by giving his ID

GET /api/v1/campaigns/:id/internshipTypes

Paths variables

KeyTypeDescription
idStringCampaign ID

200 - Internship type

{
    "id": 1,
    "label": "Russian Federation"
}

204 - No content

If the API doesn't have any campaign 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"
}

Link internship type to campaign

GET /api/v1/campaigns/:id/internshipTypes/:internship_type_id/link

Paths variables

KeyTypeDescription
idStringCampaign ID
internship_type_idStringInternship type ID

200 - OK

Ok appears on two occasions

  • If entries have been linked
  • If internship type haven't been found
OK

204 - No content

If the API doesn't have any campaign 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"
}

Get mentors related to a campaign by giving his ID

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

Paths variables

KeyTypeDescription
idStringCampaign ID

Params

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

200 - Mentors list

{
    "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 - No content

If the API doesn't have any campaign 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"
}

Link mentor to campaign

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

Paths variables

KeyTypeDescription
idStringCampaign ID
mentor_idStringMentor ID

200 - OK

Ok appears on two occasions

  • If entries have been linked
  • If mentor haven't been found
OK

204 - No content

If the API doesn't have any campaign 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"
}
← BusinessesFiles →
  • List of all campaigns
    • Params
    • 200 - List of campaigns
    • 204 - Not content
  • Create a new campaign
    • Headers
    • Body
    • 200 - Created
    • 400 - Bad request
  • Get a campaign by ID
    • Paths variables
    • 200 - Campaign
    • 204 - No content
    • 400 - Bad request
  • Update a campaign by ID
    • Paths variables
    • Headers
    • Body
    • 200 - Updated campaign
    • 204 - No content
    • 400 - Bad request
  • Remove a campaign by ID
    • Paths variables
    • 200 - Removed
    • 204 - No content
  • Get propositions related to a campaign by giving his ID
    • Paths variables
    • 200 - Propositions list
    • 204 - No content
    • 400 - Bad request
  • Link proposition to campaign
    • Paths variables
    • 200 - OK
    • 204 - No content
    • 400 - Bad request
  • Get availables internships related to a campaign by giving his ID
    • Paths variables
    • Params
    • 200 - Availables internships list
    • 204 - No content
    • 400 - Bad request
  • Link available internship to campaign
    • Paths variables
    • 200 - OK
    • 204 - No content
    • 400 - Bad request
  • Get validated internships related to a campaign by giving his ID
    • Paths variables
    • Params
    • 200 - Validated internships list
    • 204 - No content
    • 400 - Bad request
  • Link available internship to campaign
    • Paths variables
    • 200 - OK
    • 204 - No content
    • 400 - Bad request
  • Get internships related to a campaign by giving his ID
    • Paths variables
    • Params
    • 200 - Internships list
    • 204 - No content
    • 400 - Bad request
  • Get internships types related to a campaign by giving his ID
    • Paths variables
    • 200 - Internship type
    • 204 - No content
    • 400 - Bad request
  • Link internship type to campaign
    • Paths variables
    • 200 - OK
    • 204 - No content
    • 400 - Bad request
  • Get mentors related to a campaign by giving his ID
    • Paths variables
    • Params
    • 200 - Mentors list
    • 204 - No content
    • 400 - Bad request
  • Link mentor to campaign
    • Paths variables
    • 200 - OK
    • 204 - No content
    • 400 - Bad request
Copyright © 2019 ENIB