Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Filmap/filmap-api

Repository files navigation

filmap_api

Build Status StyleCI SensioLabsInsight Safadao

Table of Contents

Authenticate: [ POST ] /authenticate

Propósito: get auth token

Send a POST request with:

'email' = ,
'password' = ,

Response format:

{
	"token": xxxxxx,
}

Salve a token para demais requisições.

Ao realizar User-related calls e Film-related calls adicione a seguinte Header:

Authorization: Bearer [token]

Geo calls

get near films: [GET] /near/{radius},{lat},{lng}

Onde:

  • radius: radius in KM
  • lat <integer>: latitude
  • lng <integer>: longitude

O retorno será uma lista de filmes em um raio de radius KM:

[
	{
		"omdb":,
		"lat":,
		"lng":,
		"distance":
	},
	{
		"omdb":,
		"lat":,
		"lng":,
		"distance":
	},
	...
]

Exemplo:

POST: /near/50,37.386339,-122.085823

Retorno:

[
	{
		"omdb":"6",
		"lat":37.386339,
		"lng":-122.085823,
		"distance":0
	},
	{
		"omdb":"3",
		"lat":37.38714,
		"lng":-122.083235,
		"distance":0.245
	},
	{
		"omdb":"7",
		"lat":37.393885,
		"lng":-122.078916,
		"distance":1.037
	},
	{
		"omdb":"4",
		"lat":37.394011,
		"lng":-122.095528,
		"distance":1.209
	},
	{
		"omdb":"1",
		"lat":37.402653,
		"lng":-122.079354,
		"distance":1.901
	},
	{
		"omdb":"5",
		"lat":37.401724,
		"lng":-122.114646,
		"distance":3.067
	}
]

User-related calls

get all users: [ GET ] /user

Propósito: get all users

Response format:

[
	{
		"id":,
		"name":,
		"email":,
		"created_at":,
		"updated_at":
	},
	{
		"id":,
		"name":,
		"email":,
		"created_at":,
		"updated_at":
	},
	...
	,
	{"response":true}
]

Onde:

id: id do usuário name: nome do usuário email: e-mail do usuário

create new user: [ POST ] /user

Send a post request with:

'name' = ,
'email' = ,
'password' = ,
'password_confirmation' =,

Onde:

name: nome do usuário email: e-mail do usuário password: senha password_confirmation: mesma senha para confirmação

get user: [ GET ] /user/{ id }

Response format:

{
    "id":,
    "name":,
    "email":,
    "created_at":,
    "updated_at":,
    
    "response":true
}

Onde:

id: id do usuário name: nome do usuário email: e-mail do usuário

update user: [ PUT ] /user/{ id }

To update a user send a put request with (optional):

'name' = ,
'email' = ,
'password' = ,
'password_confirmation' =,

Onde:

name: nome do usuário email: e-mail do usuário password: senha password_confirmation: mesma senha para confirmação

Film-related calls

get all films for the authenticated user: [ GET ] /films

Response format:

[
	{
		"id":,
		"omdb":,
		"user_id":,
		"watched":,
		"created_at":,
		"updated_at":
	},
	{
		"id":,
		"omdb":,
		"user_id":,
		"watched":,
		"created_at":,
		"updated_at":
	},
	...
	,
	{"response":true}
]

save film: [ POST ] /films

Send a POST request with:

"omdb":,
"watched":,
"lat":,
"lng":

Note: lat and lng are optional inputs.

Get specific film: [ GET ] /films/{omdb}

Response format:

{
    "id":,
    "omdb":,
    "watched":,
    
    "response":true
}

Delete specific film: [ DELETE ] /films/{omdb}

Mark film as watched: [ POST ] /films/{omdb}/watch

Responses

Errors

Caso ocorra erro, o formato será:

{
    "response": false,
    "error": <error description>,
}

Success

  • POST requests will always return HTTP 200 to indicate that the operation was successful.

  • GET requests will include a "response": true within the JSON response.

Releases

No releases published

Packages

No packages published

Languages