API Gestionale ZERO

Linee guida per l’utilizzo dell’api sviluppatori.

Tutte le richieste vanno effettuate in https sotto autorizzazione di tipo ‘bearer’.

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1N...

Gli oggetti ritornati seguono la specifica HAL.

Riportare qui tutti gli errori comuni tipo autorizzazione e not found.

Identità e Accesso

Gestione del profilo utente e comproprietario.

Profilo utente

Rappresenta l’utente loggato.

GET https://api.gestionalezero.it/v1/utente
Responses200401
Headers
Content-Type: application/json
Body
{
  "_links": {
    "self": {
      "href": "/utente"
    },
    "logs": {
      "href": "/utente/logs"
    }
  },
  "id": "google-oauth2|4455363612345229809876",
  "nome": "Alex",
  "email": "alex@gestionalezero.it",
  "immagine": "https://lh4.googleusercontent.com/AAAAAAAAAKc/1123-P65n4w/photo.jpg",
  "emailVerificata": true,
  "social": false,
  "bloccato": false,
  "creatoIl": "2018-12-19T14:59:04.429Z",
  "ultimoIP": "2.32.8.48",
  "ultimoLogin": "2019-01-03T11:17:32.398Z"
}
Headers
Content-Type: application/json
Body
{
  "code": 401,
  "message": "Unauthorized",
  "type": "INVALID_TOKEN"
}

Recupera
GET/utente

Restituisce i dati del profilo utente.


PATCH https://api.gestionalezero.it/v1/utente
Requestsesempio
Headers
Content-Type: application/json
Body
{
  "nome": "Alex Bra",
  "immagine": "https://lh4.googleusercontent.com/AAAAAAAAAKc/1123-P65n4w/photo.jpg"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "nome": {
      "type": "string",
      "description": "Nome utente"
    },
    "immagine": {
      "type": "string",
      "description": "Url dell'immagine di profilo"
    }
  }
}
Responses200422
Headers
Content-Type: application/json
Body
{
  "_links": {
    "self": {
      "href": "/utente"
    }
  },
  "id": "google-oauth2|4455363612345229809876",
  "nome": "Alex Bra",
  "immagine": "https://lh4.googleusercontent.com/AAAAAAAAAKc/1123-P65n4w/photo.jpg"
}
Headers
Content-Type: application/json
Body
{
  "code": 422,
  "message": "Parameters validation error!",
  "type": "VALIDATION_ERROR",
  "data": [
    {
      "type": "stringEmpty",
      "field": "nome",
      "message": "The 'nome' field must not be empty!"
    }
  ]
}

Aggiorna
PATCH/utente

Aggiorna il nome o l’immagine del profilo utente.

I due attributi sono opzionali.

Se il nome viene indicato, va necessariamente valorizzato.


Cambia email utente

Modifica l’email dell’utente loggato.

PUT https://api.gestionalezero.it/v1/utente/cambia_email
Requestsesempio
Headers
Content-Type: application/json
Body
{
  "email": "alex@gestionalezero.it"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "description": "Email utente"
    }
  },
  "required": [
    "email"
  ]
}
Responses200422
Headers
Content-Type: application/json
Body
{
  "_links": {
    "self": {
      "href": "/utente/cambia_email"
    },
    "utente": {
      "href": "/utente"
    }
  },
  "id": "google-oauth2|4455363612345229809876",
  "email": "alex@gestionalezero.it",
  "email_verificata": "false"
}
Headers
Content-Type: application/json
Body
{
  "code": 422,
  "message": "Parameters validation error!",
  "type": "VALIDATION_ERROR",
  "data": [
    {
      "type": "stringEmpty",
      "field": "email",
      "message": "The 'email' field must not be empty!"
    }
  ]
}

Cambia email utente
PUT/utente/cambia_email


Invia email verifica

Invia un email per la verifica dell’utente loggato.

POST https://api.gestionalezero.it/v1/utente/invia_email_verifica
Responses201
Headers
Content-Type: application/json
Body
{
  "_links": {
    "self": {
      "href": "/utente/invia_email_verifica"
    },
    "utente": {
      "href": "/utente"
    }
  },
  "id": "google-oauth2|4455363612345229809876",
  "email": "alex@gestionalezero.it"
}

Invia email verifica
POST/utente/invia_email_verifica


Ticket cambio password

Crea un ticket per effettuare il cambio password.

POST https://api.gestionalezero.it/v1/utente/ticket_cambio_password
Requestsesempio
Headers
Content-Type: application/json
Body
{
  "url_ritorno": "https://app.gestionalezero.it/utente"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "url_ritorno": {
      "type": "string",
      "description": "Url cui essere reindirizzati dopo l'avvenuto cambio"
    }
  },
  "required": [
    "url_ritorno"
  ]
}
Responses201403
Headers
Content-Type: application/json
Body
{
  "_links": {
    "self": {
      "href": "/utente/ticket_cambio_password"
    },
    "utente": {
      "href": "/utente"
    }
  },
  "id": "google-oauth2|4455363612345229809876",
  "ticket": "https://login.gestionalezero.it/lo/reset?ticket=oOBQ9lFFsWvixl3NFBfkHqBAKsw18lmu#"
}
Headers
Content-Type: application/json
Body
{
  "code": 403,
  "message": "Forbidden",
  "type": "INVALID_OPERATION",
  "data": {
    "message": "Il cambio password di un utente 'social' non è permesso"
  }
}

Ticket cambio password
POST/utente/ticket_cambio_password

L’utente registrato tramite profilo social, non può effettuare il cambio password tramite questa API.

In tal caso il cambio password può avvenire solo tramite Facebook o Google.


Generated by aglio on 03 Jan 2019