Skip to content

Endpoints

Pablo Martínez Figueroa edited this page Mar 27, 2019 · 29 revisions

Login POST /api/v1/login

What you send:

{
  "username": "sample",
  "password": "sample-password"
}

What you'll receive:

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}

Hello World GET /api/v1/helloworld

Headers:

{
  "Authentication": "JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}

What you'll receive:

{
  "saludo": "Hola, <<Username>>"
}

list apply GET /api/v1/apply

Para los filtros PE, AC,RE

{
userId:2
filtro:PE
}

What you'll receive:

[
    {
        "id": 1,
        "title": "apply1",
        "description": "wdwd",
        "date": "2019-03-24T23:21:14Z",
        "status": "PE",
        "dataScientist_id": 1,
        "offer_id": 1
    }
]

create apply POST /api/v1/apply

{
title:Titulo
description:description
offerId:1
}

What you'll receive:

{
    "message": "Successfully created new apply"
}

Accept apply POST api/v1/accept/

{
idApply:1
}

What you'll receive:

{
    "id": 2,
    "title": "apply2",
    "description": "apply of data2",
    "date": "2019-03-28T10:54:50Z",
    "status": "AC",
    "dataScientist": 2,
    "offer": 1
}

Si incumple alguna restricción, estos son las posibles respuestas:

{"message":"Offer has been already accepted"}

{"message":"The company doesnt own the offer"}

{"message":"Only companies can update an apply"}

list offer GET /api/v1/offer

No necesita parámetros, tan solo petición GET a la url

What you'll receive:

[
    {
        "id": 1,
        "title": "offer1",
        "description": "offer1",
        "price_offered": 300,
        "currency": "0",
        "creation_date": "2019-03-24T17:42:05.983Z",
        "limit_time": "2019-03-27T17:42:02Z"
    }
]

Create offer POST /api/v1/offer

{
  "title": TEXT("test title"),
  "description": TEXT("test description"),
  "price_offered": FLOAT(1500.99),
  "currency": CHOICE('0'->EUROS, '1'->DOLLARS, '2'->POUNDS),
  "limit_time": DATETIME(7 attributes are being sent, https://docs.python.org/3/library/datetime.html, Attributes: year, month, day, hour, minute, second, microsecond), (2019,10,30,10,40,0,0)
}

ver mi CV GET /api/v1/cv

Lo que devuelve es la lista de items completa del CV. No necesita parametro ya que se hace desde el usuario logeado.

What you'll receive:

[
    "[{\"model\": \"datame.item\", \"pk\": 1, \"fields\": {\"name\": \"Item 1 Name\", \"section\": 1, \"description\": \"Item 1 description\", \"entity\": \"entity test\", \"date_start\": \"2018-03-27T09:54:52Z\", \"date_finish\": null}}]",
    "[{\"model\": \"datame.item\", \"pk\": 2, \"fields\": {\"name\": \"Item 2 Name\", \"section\": 2, \"description\": \"item 2 description\", \"entity\": \"entity test\", \"date_start\": \"2018-03-27T09:55:15Z\", \"date_finish\": null}}]"
]

ver CV de otro GET /api/v1/cv

Lo que devuelve es la lista de items completa del CV. Se le pasa el userId del DataScientist del que se quiere ver el CV

{
dataScientistId:2
}

What you'll receive:

[
    "[{\"model\": \"datame.item\", \"pk\": 1, \"fields\": {\"name\": \"Item 1 Name\", \"section\": 1, \"description\": \"Item 1 description\", \"entity\": \"entity test\", \"date_start\": \"2018-03-27T09:54:52Z\", \"date_finish\": null}}]",
    "[{\"model\": \"datame.item\", \"pk\": 2, \"fields\": {\"name\": \"Item 2 Name\", \"section\": 2, \"description\": \"item 2 description\", \"entity\": \"entity test\", \"date_start\": \"2018-03-27T09:55:15Z\", \"date_finish\": null}}]"
]


ver tu perfil siendo una Company GET /api/v1/company

No requiere parámetros ya que se obtiene del usuario loggeado

What you'll receive:

[
    {
        "id": 1,
        "user_id": 3,
        "name": "Company 1 Name",
        "description": "Company 1 Description",
        "nif": "44064406T",
        "logo": "https://logo.png"
    }
]


ver el perfil de una Company (siendo DataScientist) GET /api/v1/company

{
companyId:3
}

What you'll receive:

[
    {
        "id": 1,
        "user_id": 3,
        "name": "Company 1 Name",
        "description": "Company 1 Description",
        "nif": "44064406T",
        "logo": "https://logo.png"
    }
]


Creating a CV POST api/v1/cv

There is no need to pass data, this petition will create a CV for the user that is logged at the moment the request is sent.

What you will recieve:

{
    "message": "Successfully created new curriculum"
}

Creating a Section of a CV POST api/v1/section

You will need to pass a field as shown below. The petition will create a section on the curriculum of the user that it is currently logged in, if it has one.

{
  "name": TEXT("Sample")
}

Note that the 'name' value must be a Section name created by an administrator.

What you will recieve:

{
    "message": "Successfully created new section"
}

Creating an Item POST api/v1/item

{
  "name": TEXT("Sample name")
  "secid": INTEGER()("1")
  "description": TEXT("Sample description")
  "entity": TEXT("Sample entity")
  "datestart":  DATETIME()("2019-11-12 23:58")
  "datefinish":  DATETIME()("2019-11-13 00:00")
}

Note that 'datefinish' is completely optional. However, it must be a date after 'datestart'

What you will recieve:

{
    "message": "Successfully created new item"
}

Updating an Item POST api/v1/item

{
  "itemid": INTEGER()("1")
  "name": TEXT("Sample name")
  "secid": INTEGER()("1")
  "description": TEXT("Sample description")
  "entity": TEXT("Sample entity")
  "datestart":  DATETIME()("2019-11-12 23:58")
  "datefinish":  DATETIME()("2019-11-13 00:00")
}

Note that 'datefinish' is completely optional. However, it must be a date after 'datestart'

What you will recieve:

{
    "message": "Successfully edited item"
}

Creating a Message POST api/v1/message

You write the title and body of the message and the id of the user you want to send it to. It is necessary to add in the header the token of the user you are logged in.

{
  "title": TEXT("asunto test")
  "body": TEXT("increible mensaje")
  "receiverId": 3         
}

What you will recieve:

{
    "message": "Successfully created new message"
}

List messages received GET api/v1/message

You only need to add the token of the logged user in the header

What you will recieve:

{
        "id": 1,                                 #id of the message
        "receiver_id": 3,                        #id of de receiver user
        "sender_id": 2,                          #id of the sender user
        "title": "asunto test",                  
        "body": "increible mensaje",
        "moment": "2019-03-26T21:57:23.891Z"
}

Clone this wiki locally