Init session

  • URL: /apirest/initSession/
  • Description: Request a session token to uses other api endpoints.

  • Method: GET

  • Parameters: (Headers)

    • Authorization: user_token q56hqkniwot8wntb3z1qawtrert
    • Content-Type: application/json
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

Init session

Error Messages

JSON response
ERROR_LOGIN_PARAMETERS_MISSING

parameter(s) login, password or user_token are missing

ERROR_GLPI_LOGIN_USER_TOKEN

parameter user_token seems invalid

ERROR

API disabled

ERROR_NOT_ALLOWED_IP

There isn't an active api client matching your ip adress in the configuration (127.0.0.1)

TXT response

HTML response

  • Content-Type →text/html; charset=UTF-8
  • Access-Control-Expose-Headers
    content-type, content-range, accept-range
  • Content-Type
    application/json; charset=UTF-8

Init session

Response

{
    "session_token": "ohmrb93vgb9dps9sgmnp1bg9h0"
}

Kill session

  • URL: /apirest/killSession/
  • Description: Destroy a session identified by a session token.

  • Method: GET

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint. Mandatory.
    • Content-Type: application/json
  • Returns:
    • 200 (OK).
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

Kill session

Error Messages

JSON response
ERROR_SESSION_TOKEN_INVALID

session_token seems invalid

ERROR_SESSION_TOKEN_MISSING

parameter session_token is missing or empty

ERROR

API disabled

ERROR_NOT_ALLOWED_IP

There isn't an active api client matching your ip adress in the configuration (127.0.0.1)

TXT response

HTML response

  • Content-Type →text/html; charset=UTF-8

Reset password request

  • URL: /apirest/lostPassword/
  • Description: Sends a notification to the user to reset his password.

  • Method: PUT

  • Parameters: (Headers)

    • Content-Type: application/json
  • Parameters: (JSON Payload)
    • email: email address of the user to recover. Mandatory.
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.

Reset password request

Error Messages

JSON response

ERROR

Email address not found.

A session is active

email parameter missing

Only HTTP verb PUT is allowed

Email notifications are disabled

TXT response
HTML response

  • Content-Type →text/html; charset=UTF-8
  • Access-Control-Expose-Headers
    content-type, content-range, accept-range
  • Content-Type
    application/json; charset=UTF-8

Reset password request

Response

[
    "An email has been sent to your email address. The email contains information for reset your password."
]

Password reset

  • URL: /apirest/lostPassword/
  • Description: Sends a notification to the user to reset his password.

  • Method: PUT

  • Parameters: (Headers)

    • Content-Type: application/json
  • Parameters: (JSON Payload)
    • email: email address of the user to recover. Mandatory.
    • password_forget_token: reset token
    • password: the new password for the user
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.

Password reset

Error Messages

JSON response

ERROR

Email address not found.

Your password reset request has expired or is invalid.

Please renew it.

email parameter missing

Only HTTP verb PUT is allowed

Email notifications are disabled

TXT response
HTML response

  • Content-Type →text/html; charset=UTF-8
  • Access-Control-Expose-Headers
    content-type, content-range, accept-range
  • Content-Type
    application/json; charset=UTF-8

Password reset

Response

[
    "Reset password successful."
]

Get my profiles

  • URL: /apirest/getMyProfiles/
  • Description: Return all the profiles associated to logged user.

  • Method: GET

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: application/json
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

Get active profile

  • URL: /apirest/getActiveProfile/
  • Description: Return the current active profile.

  • Method: GET

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: application/json
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

Change active profile

  • URL: /apirest/changeActiveProfile/
  • Description: Change active profile to the profiles_id one.

  • Method: POST

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: application/json
  • Parameters: (JSON Payload)
    • profiles_id: (default 'all') ID of the new active profile.
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

Get my entities

  • URL: /apirest/getMyEntities/
  • Description: Return all the possible entities of the current logged user (and for current active profile).

  • Method: GET

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: application/json
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

Get active entities

  • URL: /apirest/getActiveEntities/
  • Description: Return active entities of current logged user.

  • Method: GET

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: application/json
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

Change active entities

  • URL: /apirest/changeActiveEntities/
  • Description: Change active entity to the entities_id one.

  • Method: POST

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: application/json
  • Parameters: (JSON Payload)
    • entities_id: (default 'all') ID of the new active entity.
    • is_recursive: (default false) Display sub entities of the active entity.
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a proper error message.
    • 401 (UNAUTHORIZED)

Get full session

  • URL: /apirest/getFullSession/
  • Description: Return the current php $_SESSION.

  • Method: GET

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: application/json
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

Get GLPI config

  • URL: /apirest/getGlpiConfig/
  • Description: Return the current $CFG_GLPI.

  • Method: GET

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: application/json
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

Get an item

  • URL: /apirest/:itemtype/:id
  • Description: Return the instance fields of itemtype identified by id.

  • Method: GET

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: application/json
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

Get all items

  • URL: /apirest/:itemtype/
  • Description: Return a collection of rows of the itemtype.

  • Method: GET

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: application/json
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

Get sub items

  • URL: /apirest/:itemtype/:id/:sub_itemtype/
  • Description: Return a collection of rows of the sub_itemtype for the identified item.

  • Method: GET

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: application/json
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

Get multiple items

  • URL: /apirest/getMultipleItems/
  • Description: Virtually call Get an item for each line in input. So, you can have a ticket, an user in the same query.

  • Method: GET

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: application/json
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

List searchOptions

  • URL: /apirest/listSearchOptions/:itemtype/
  • Description: List the searchoptions of provided itemtype. To use with Search items.

  • Method: GET

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: application/json
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

Search items

  • URL: /apirest/search/:itemtype/
  • Description: Expose the GLPI searchEngine and combine criteria to retrieve a list of elements of specified itemtype.

  • Method: GET

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: application/json
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

Add item(s)

  • URL: /apirest/:itemtype/
  • Description: Add an object (or multiple objects) into GLPI.

  • Method: POST

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: application/json
  • Parameters: (JSON Payload)
    • input: an object with fields of itemtype to be inserted. You can add several items in one action by passing an array of objects.
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

Update item(s)

  • URL: /apirest/:itemtype/:id/
  • Description: Update an object (or multiple objects).

  • Method: PUT

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: application/json
  • Parameters: (JSON Payload)
    • id: the unique identifier of the itemtype passed in URL. You could skip this parameter by passing it in the input payload.
    • input: Array of objects with fields of itemtype to be updated.
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a proper error message.
    • 401 (UNAUTHORIZED)

Delete item(s)

  • URL: /apirest/:itemtype/:id/
  • Description: Delete an object existing in GLPI.

  • Method: DELETE

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: application/json
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

Upload a document file

  • URL: /apirest/:itemtype/
  • Description: See Add item(s) and apply specific instructions below.

  • Method: POST

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Content-Type: multipart/form-data
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

Download a document file

  • URL: /apirest/:itemtype/
  • Description: Download a document.

  • Method: GET

  • Parameters: (Headers)

    • Session-Token: session var provided by initSession endpoint.
    • Accept: application/octet-stream
  • Returns:
    • 200 (OK) with the session_token string.
    • 400 (Bad Request) with a message indicating an error in input parameter.
    • 401 (UNAUTHORIZED)

deck

By Alexander Salas Bastidas

deck

Workshop

  • 1,041