Skip to content

Instantly share code, notes, and snippets.

@diaraujo13
Created April 25, 2018 02:49
Show Gist options
  • Save diaraujo13/20d4f7d00f7158b5d658b9a4586f9a3f to your computer and use it in GitHub Desktop.
Save diaraujo13/20d4f7d00f7158b5d658b9a4586f9a3f to your computer and use it in GitHub Desktop.
GLPI API - Basic calls to tickets endpoint
{
"variables": [],
"info": {
"name": "GLPI API",
"_postman_id": "93d36159-3fa9-bed0-ff15-ad4cc5cc6abb",
"description": "",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Init Session",
"request": {
"url": "http://200.133.4.158/apirest.php/Ticket/1/",
"method": "GET",
"header": [
{
"key": "App-Token",
"value": "hjmba48mw0yn08unueo3gg4eozc8w9i5rpy65w47",
"description": ""
},
{
"key": "Content-Type",
"value": "application/json",
"description": ""
},
{
"key": "Authorization",
"value": "Basic aXphaWFzOml6YWlhcw==",
"description": ""
},
{
"key": "Session-Token",
"value": "7j2gs9r99fq2hlt9t4sanrd3j6",
"description": ""
}
],
"body": {},
"description": ""
},
"response": []
},
{
"name": "Get all tickets",
"request": {
"url": "http://200.133.4.158/apirest.php/Ticket",
"method": "GET",
"header": [
{
"key": "App-Token",
"value": "hjmba48mw0yn08unueo3gg4eozc8w9i5rpy65w47",
"description": ""
},
{
"key": "Content-Type",
"value": "application/json",
"description": ""
},
{
"key": "Authorization",
"value": "Basic aXphaWFzOml6YWlhcw==",
"description": ""
},
{
"key": "Session-Token",
"value": "7j2gs9r99fq2hlt9t4sanrd3j6",
"description": ""
}
],
"body": {},
"description": ""
},
"response": []
},
{
"name": "Get current user Id",
"request": {
"url": "http://200.133.4.158/apirest.php/getActiveProfile",
"method": "GET",
"header": [
{
"key": "App-Token",
"value": "hjmba48mw0yn08unueo3gg4eozc8w9i5rpy65w47",
"description": ""
},
{
"key": "Content-Type",
"value": "application/json",
"description": ""
},
{
"key": "Authorization",
"value": "Basic aXphaWFzOml6YWlhcw==",
"description": ""
},
{
"key": "Session-Token",
"value": "7j2gs9r99fq2hlt9t4sanrd3j6",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\"input\": {\n\t\n\t \n \"tickets_id\": 1, \"content\": \"Resolvido asdasd\"\n \n\t}\n}"
},
"description": ""
},
"response": []
},
{
"name": "Get current user details",
"request": {
"url": "http://200.133.4.158/apirest.php/User/8",
"method": "GET",
"header": [
{
"key": "App-Token",
"value": "hjmba48mw0yn08unueo3gg4eozc8w9i5rpy65w47",
"description": ""
},
{
"key": "Content-Type",
"value": "application/json",
"description": ""
},
{
"key": "Authorization",
"value": "Basic aXphaWFzOml6YWlhcw==",
"description": ""
},
{
"key": "Session-Token",
"value": "7j2gs9r99fq2hlt9t4sanrd3j6",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\"input\": {\n\t\n\t \n \"tickets_id\": 1, \"content\": \"Resolvido asdasd\"\n \n\t}\n}"
},
"description": ""
},
"response": []
},
{
"name": "Get all ticket with ID 1",
"request": {
"url": "http://200.133.4.158/apirest.php/Ticket/1",
"method": "GET",
"header": [
{
"key": "App-Token",
"value": "hjmba48mw0yn08unueo3gg4eozc8w9i5rpy65w47",
"description": ""
},
{
"key": "Content-Type",
"value": "application/json",
"description": ""
},
{
"key": "Authorization",
"value": "Basic aXphaWFzOml6YWlhcw==",
"description": ""
},
{
"key": "Session-Token",
"value": "7j2gs9r99fq2hlt9t4sanrd3j6",
"description": ""
}
],
"body": {},
"description": ""
},
"response": []
},
{
"name": "Get all ticket with ID 1 TicketFollowup",
"request": {
"url": "http://200.133.4.158/apirest.php/Ticket/1/TicketFollowup",
"method": "GET",
"header": [
{
"key": "App-Token",
"value": "hjmba48mw0yn08unueo3gg4eozc8w9i5rpy65w47",
"description": ""
},
{
"key": "Content-Type",
"value": "application/json",
"description": ""
},
{
"key": "Authorization",
"value": "Basic aXphaWFzOml6YWlhcw==",
"description": ""
},
{
"key": "Session-Token",
"value": "7j2gs9r99fq2hlt9t4sanrd3j6",
"description": ""
}
],
"body": {},
"description": ""
},
"response": []
},
{
"name": "Add Ticket - Retorna ID",
"request": {
"url": "http://200.133.4.158/apirest.php/Ticket/",
"method": "POST",
"header": [
{
"key": "App-Token",
"value": "hjmba48mw0yn08unueo3gg4eozc8w9i5rpy65w47",
"description": ""
},
{
"key": "Content-Type",
"value": "application/json",
"description": ""
},
{
"key": "Authorization",
"value": "Basic aXphaWFzOml6YWlhcw==",
"description": ""
},
{
"key": "Session-Token",
"value": "7j2gs9r99fq2hlt9t4sanrd3j6",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\"input\": {\n\t\n\t \n\t\t\"name\": \"TESTE IZAIAS Derramei café no computador\",\n \"content\": \"Resolvido asdasd\",\n \"urgency\": 5,\n\t\t\"impact\": 5,\n\t\t\"itilcategories_id\": 0,\n\t\t\"type\": 2\n\t\t}\n}"
},
"description": ""
},
"response": []
},
{
"name": "Add TicketFollowUp ao Ticket com ID 1",
"request": {
"url": "http://200.133.4.158/apirest.php/Ticket/1/TicketFollowup",
"method": "POST",
"header": [
{
"key": "App-Token",
"value": "hjmba48mw0yn08unueo3gg4eozc8w9i5rpy65w47",
"description": ""
},
{
"key": "Content-Type",
"value": "application/json",
"description": ""
},
{
"key": "Authorization",
"value": "Basic aXphaWFzOml6YWlhcw==",
"description": ""
},
{
"key": "Session-Token",
"value": "7j2gs9r99fq2hlt9t4sanrd3j6",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\"input\": {\n\t\n\t \n \"tickets_id\": 1, \"content\": \"Resolvido asdasd\"\n \n\t}\n}"
},
"description": ""
},
"response": []
},
{
"name": "Get all category",
"request": {
"url": "http://200.133.4.158/apirest.php/ITILCategory",
"method": "GET",
"header": [
{
"key": "App-Token",
"value": "hjmba48mw0yn08unueo3gg4eozc8w9i5rpy65w47",
"description": ""
},
{
"key": "Content-Type",
"value": "application/json",
"description": ""
},
{
"key": "Authorization",
"value": "Basic aXphaWFzOml6YWlhcw==",
"description": ""
},
{
"key": "Session-Token",
"value": "7j2gs9r99fq2hlt9t4sanrd3j6",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\"input\": {\n\t\n\t \n \"tickets_id\": 1, \"content\": \"Resolvido asdasd\"\n \n\t}\n}"
},
"description": ""
},
"response": []
},
{
"name": "Get all location",
"request": {
"url": "http://200.133.4.158/apirest.php/Location",
"method": "GET",
"header": [
{
"key": "App-Token",
"value": "hjmba48mw0yn08unueo3gg4eozc8w9i5rpy65w47",
"description": ""
},
{
"key": "Content-Type",
"value": "application/json",
"description": ""
},
{
"key": "Authorization",
"value": "Basic aXphaWFzOml6YWlhcw==",
"description": ""
},
{
"key": "Session-Token",
"value": "7j2gs9r99fq2hlt9t4sanrd3j6",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\"input\": {\n\t\n\t \n \"tickets_id\": 1, \"content\": \"Resolvido asdasd\"\n \n\t}\n}"
},
"description": ""
},
"response": []
}
]
}
@diaraujo13
Copy link
Author

diaraujo13 commented Aug 10, 2018

Search criteria for Tickets

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://200.133.4.158/apirest.php/search/Ticket/?order=DESC&criteria[0][link]=AND&criteria[0][itemtype]=Ticket&criteria[0][field]=4&criteria[0][searchtype]=contains&criteria[0][value]=10&forcedisplay=4",
  "method": "GET",
  "headers": {
    "Session-Token": "4913udsgnbtr5j3mve84rvcdh1",
    "Cache-Control": "no-cache",
    "Postman-Token": "b18fe7e7-6feb-4e92-8f6a-ffab85e1c032"
  }
}
http://200.133.4.158/apirest.php/search/Ticket/?order=DESC&criteria[0][link]=AND&criteria[0][itemtype]=Ticket&criteria[0][field]=12&criteria[0][searchtype]=contains&criteria[0][value]=all&criteria[1][itemtype]=Ticket&criteria[0][link]=AND&criteria[1][field]=4&criteria[1][searchtype]=equals&criteria[1][value]=8&forcedisplay[0]=12&forcedisplay[0]=21&forcedisplay[2]=15
{
    "totalcount": 3,
    "count": 3,
    "sort": 1,
    "order": "DESC",
    "data": [
        {
            "1": "Mudança do estabilizador do ponto",
            "2": 116,
            "4": 8,
            "12": 6,
            "15": "2018-08-09 15:09:46",
            "21": "<p>Movidos.</p>"
        },
        {
            "1": "Máquinas no laboratório de informática ",
            "2": 28,
            "4": 8,
            "12": 2,
            "15": "2018-03-21 17:28:20",
            "21": "Reboot and select proper boot device\nor inseert boot media in selected boot device and press a key"
        },
        {
            "1": "Conexão direta do scanner impressora com estações de trabalho",
            "2": 117,
            "4": 8,
            "12": 6,
            "15": "2018-08-09 17:56:28",
            "21": "<p>--</p>"
        }
    ],
    "content-range": "0-2/3"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment