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

Files

Details of routes to handle files

List of all files

GET /api/v1/files

Params

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

200 - List of files

{
    "page": "1",
    "data": [
        {
            "id": 1,
            "name": "Human Directives Administrator",
            "size": 13583,
            "type": "int-desc",
            "path": "file_name.pdf",
            "createdAt": "2019-10-13T16:24:13.000Z",
            "updatedAt": "2019-10-13T16:24:13.000Z"
        },
    ],
    "length": 1,
    "max": 1
}

204 - Not content

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

Create a new file

POST /api/v1/files

Headers

KeyValueDescription
Content-Typeapplication/form-dataBody encoding

Body

KeyTypeOptionalDescription
nameStringnoFile name
typeStringnoFile type
fileFilenoFile to setup

200 - Created

Return created file

{
    "id": 1,
    "name": "Human Directives Administrator",
    "size": 13583,
    "type": "int-desc",
    "path": "file_name.pdf",
    "createdAt": "2019-10-13T16:24:13.000Z",
    "updatedAt": "2019-10-13T16:24:13.000Z"
}

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 file by ID

GET /api/v1/files/:id

Paths variables

KeyTypeDescription
idStringFile ID

200 - File

{
    "id": 1,
    "name": "Human Directives Administrator",
    "size": 13583,
    "type": "int-desc",
    "path": "file_name.pdf",
    "createdAt": "2019-10-13T16:24:13.000Z",
    "updatedAt": "2019-10-13T16:24:13.000Z"
}

204 - No content

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

Update a file by ID

PUT /api/v1/files/:id

Paths variables

KeyTypeDescription
idStringFile ID

Headers

KeyValueDescription
Content-Typeapplication/form-dataBody encoding

Body

KeyTypeOptionalDescription
nameStringyesFile name
typeStringyesFile type
fileFileyesFile to setup

200 - Updated file

{
    "id": 1,
    "name": "Human Directives Administrator",
    "size": 13583,
    "type": "int-desc",
    "path": "file_name.pdf",
    "createdAt": "2019-10-13T16:24:13.000Z",
    "updatedAt": "2019-10-13T16:24:13.000Z"
}

204 - No content

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

DELETE /api/v1/files/:id

Paths variables

KeyTypeDescription
idStringFile ID

200 - Removed

Return a status 200 without data when delete succeed

204 - No content

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

Get internships related to a file by giving his ID

GET /api/v1/files/:id/internships

Paths variables

KeyTypeDescription
idStringFile ID

Params

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

200 - Internships

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

204 - No content

If the API doesn't have any file 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 to file

GET /api/v1/files/:id/internships/:internship_id/link

Paths variables

KeyTypeDescription
idStringFile ID
internship_idStringInternship 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 file 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"
}
← CampaignsInternships →
  • List of all files
    • Params
    • 200 - List of files
    • 204 - Not content
    • 400 - Bad request
  • Create a new file
    • Headers
    • Body
    • 200 - Created
    • 400 - Bad request
  • Get a file by ID
    • Paths variables
    • 200 - File
    • 204 - No content
  • Update a file by ID
    • Paths variables
    • Headers
    • Body
    • 200 - Updated file
    • 204 - No content
    • 400 - Bad request
  • Remove a file by ID
    • Paths variables
    • 200 - Removed
    • 204 - No content
  • Get internships related to a file by giving his ID
    • Paths variables
    • Params
    • 200 - Internships
    • 204 - No content
    • 400 - Bad request
  • Link internship to file
    • Paths variables
    • 200 - OK
    • 204 - No content
    • 400 - Bad request
Copyright © 2019 ENIB