Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

A seguir será descrito como buscar dados de Slot e PON de um Splitter a partir da API do OZmap. Os dados de Slot e PON estão presentes nas propriedades slot e pon do objeto Splitter, que contêm os IDs correspondentes. Existem duas abordagens principais para realizar essa busca:

  1. Busca Direta pelos IDs: Nesta abordagem, os dados de Slot e PON são obtidos utilizando os IDs presentes nas propriedades do Splitter.

  2. Busca com query populate: Nesta abordagem, a query populate é utilizada para obter os dados de Slot e PON diretamente na chamada para o Splitter.

➡️ Exemplo

1. Busca Direta pelos IDs

Para buscar os dados de Slot e PON, pode-se utilizar os IDs presentes nas propriedades slot e pon do Splitter. Abaixo, será apresentado um exemplo prático utilizando um Splitter com o ID 5da7248311450e0006947b40.The OLT, Slot and PON data are located in the olt, slot, and pon properties of a Splitter. There are two main approaches to retrieve this data:

  1. Direct Retrieval by IDs: In this method, Slot and PON data are obtained using the IDs present in the Splitter's properties.

  2. Search with a populate query: This method involves using the populate query to fetch Slot and PON data directly in the Splitter request.

➡️ Example

1. Direct Retrieval by IDs

To retrieve Slot and PON data, you can use the IDs present in the slot and pon properties of the Splitter. Below is a practical example using a Splitter with ID 5da7248311450e0006947b40:

Code Block
languagejs
    "isBalanced": true,
    "orientation": "right",
    "implanted": true,
    "isDrop": true,
    "kind": "Splitter",
    "parent": "5da7248311450e0006947b3c",
    "project": "5d9f3ff9200141000647f814",
    "name": "Splitter 1",
    "splitterType": "5b74204cffd4524508626953",
    "connectables": {
        "input": [
            "5da724b3f003e83fc000001b"
        ],
        "output": [
            "646fbbdb48566b0020b1af68",
            null,
            null,
            null,
            null,
            null,
            null,
            null
        ],
        "id": "6784fec0de2d97f2805bacfe"
    },
    "ratio": {
        "output": 8,
        "input": 1,
        "id": "6784fec0de2d97f2805bacff"
    },
    "createdAt": "2019-10-16T14:09:07.809Z",
    "updatedAt": "2024-11-07T23:58:08.703Z",
    "olt": "5da61f6a493d9c000666552f",
    "pon": "5da722ef11450e0006947ab8",
    "slot": "5da722ef11450e0006947ab0",
    "id": "5da7248311450e0006947b40"
    ...
}
  • Buscando de dados do Slot

...

  • Retrieving OLT data

To fetch the OLT data, send the following request to the olts endpoint for the ID 5da61f6a493d9c000666552f:

Code Block
languagejs
curl --location -g --request GET 'https://example.ozmap.com.br:9994/api/v2/slotsolts/5da722ef11450e0006947ab05da61f6a493d9c000666552f
--header 'Authorization: <API Key>' \

A resposta esperada para essa chamada éThe expected response is:

Code Block
languagejs
{
    "label": "4444",
    "port": 22,
    "connectables": [
        "5da722ef11450e0006947aaf5da61f6a493d9c000666552e",
        "5da722ef11450e0006947ab35da61f6a493d9c0006665533",
        "5da722ef11450e0006947ab75da722ef11450e0006947aaf",
    ],
    "5da722f011450e0006947abbattenuation": [],
    "implanted": true,
    "5da722f011450e0006947abfisDrop": false,
        "5da722f011450e0006947ac3"kind": "OLT",
       "parent": "5da722f011450e0006947ac75da61d35493d9c0006665404",
       "project": "5da722f011450e0006947acb5d9f3ff9200141000647f814",
        "5da722f011450e0006947acf"oltType": "5cb5d737aacc5e394036ce92",
    "name": "OLT   1"5da722f011450e0006947ad3",
        "5da722f011450e0006947ad7",
   "user": "",
    "5da722f011450e0006947adbip",
        "5da722f011450e0006947adf"
    ]: "192.168.0.2",
    "attenuationpassword": []"",
    "implantedcreatedAt": true"2019-10-15T19:35:06.989Z",
    "isDropupdatedAt": false,
    "kind": "Slot"2024-12-07T20:55:47.227Z",
    "nameindex": "2"1,
    "parentshelf": "5da61d35493d9c00066654045da61f5a493d9c000666552d",
    "projectsize": "5d9f3ff9200141000647f814"1,
    "createdAtid": "2019-10-16T14:02:23.868Z",
    "updatedAt": "2024-08-16T13:09:50.253Z",5da61f6a493d9c000666552f"
}
  • Retrieving Slot data

To fetch the Slot data, send the following request to the slots endpoint for the ID 5da722ef11450e0006947ab0:

Code Block
languagejs
curl --location -g --request GET 'https://example.ozmap.com.br:9994/api/v2/slots/5da722ef11450e0006947ab0
--header 'Authorization: <API Key>' \

The expected response is:

Code Block
languagejs
{
    "starting_pon_number"label": 1"",
    "oltconnectables": [
"5da61f6a493d9c000666552f        "5da722ef11450e0006947aaf",
        "id":5da722ef11450e0006947ab3",
        "5da722ef11450e0006947ab0"
}

Na resposta, a propriedade name refere-se à porta do Slot (neste caso, porta 2) e starting_pon_number indica a porta inicial do PON (iniciando em 1).

  • Buscando de dados do PON

Para buscar informações do PON, será realizada a seguinte chamada para a rota pons buscando o PON com ID 5da722ef11450e0006947ab8:

Code Block
languagejs
curl --location -g --request GET 'https://example.ozmap.com.br:9994/api/v2/pons/5da722ef11450e0006947ab8
--header 'Authorization: <API Key>' \

A resposta esperada para essa chamada é:

Code Block
languagejs
{5da722ef11450e0006947ab7",
        "5da722f011450e0006947abb",
        "5da722f011450e0006947abf",
        "5da722f011450e0006947ac3",
        "5da722f011450e0006947ac7",
        "5da722f011450e0006947acb",
        "connectables5da722f011450e0006947acf": [,
        "5da722ef11450e0006947ab75da722f011450e0006947ad3",
        "66bf500450ce3b0014a529135da722f011450e0006947ad7",
    ],     "maximumClients": null,5da722f011450e0006947adb",
        "label": ""5da722f011450e0006947adf"
    ],
    "attenuation": [],
    "implanted": true,
    "isDrop": false,
    "kind": "PONSlot",
    "name": "2",
    "parent": "5da61d35493d9c0006665404",
    "project": "5d9f3ff9200141000647f814",
    "potency": 2,
    "createdAt": "2019-10-16T14:02:23.973Z868Z",
    "updatedAt": "2024-08-16T13:1109:3250.332Z253Z",
    "oltstarting_pon_number": "5da61f6a493d9c000666552f"1,
    "slotolt": "5da722ef11450e0006947ab05da61f6a493d9c000666552f",
    "id": "5da722ef11450e0006947ab85da722ef11450e0006947ab0"
}

Assim como no Slot, a propriedade name refere-se à porta do PON (neste caso, porta 2)

Com as informações obtidas, podemos concluir que o Splitter com ID 5da7248311450e0006947b40 está conectado ao Slot de número 2 e à porta PON de número 2.

2. Busca com query populate

Outra forma de obter os dados de Slot e PON é utilizando a query populate na chamada para buscar os dados do Splitter. Para o Splitter com ID 5da7248311450e0006947b40, a chamada seria:

Code Block
languagejs
curl --location -g --request GET 'https://example.ozmap.com.br:9994/api/v2/splitters/5da7248311450e0006947b40?populate=slot pon
--header 'Authorization: <API Key>' \

A resposta esperada para essa chamada é:

...

languagejs

...

Here, the name property refers to the Slot port (in this case, port 2), and starting_pon_number indicates the starting PON port (starting at 1).

  • Retrieving PON data

To fetch the PON data, send the following request to the pons endpoint for the ID 5da722ef11450e0006947ab8:

Code Block
languagejs
curl --location -g --request GET 'https://example.ozmap.com.br:9994/api/v2/pons/5da722ef11450e0006947ab8
--header 'Authorization: <API Key>' \

The expected response is:

Code Block
languagejs
{
    "connectables": [
        "5da722ef11450e0006947ab7",
        "66bf500450ce3b0014a52913"
    ],
    "maximumClients": null,
    "label": "",
    "attenuation": [],
    "implanted": true,
    "isDrop": false,
    "kind": "PON",
    "name": "2",
    "parent": "5da61d35493d9c0006665404",
    "project": "5d9f3ff9200141000647f814",
    "potency": 2,
    "createdAt": "2019-10-16T14:02:23.973Z",
    "updatedAt": "2024-08-16T13:11:32.332Z",
    "olt": "5da61f6a493d9c000666552f",
    "slot": "5da722ef11450e0006947ab0",
    "id": "5da722ef11450e0006947ab8"
}

Here, the name property refers to the PON port (in this case, port 2).

Based on the information gathered, we can conclude that the Splitter with ID 5da7248311450e0006947b40 is connected to the OLT named "OLT 1", on Slot number 2 and PON port number 2.

2. Search with a populate query

Alternatively, you can use the populate query to fetch the OLT, Slot and PON data directly in the Splitter request. For the Splitter ID 5da7248311450e0006947b40, the request would be:

Code Block
languagejs
curl --location -g --request GET 'https://example.ozmap.com.br:9994/api/v2/splitters/5da7248311450e0006947b40?populate=olt slot pon
--header 'Authorization: <API Key>' \

The expected response is:

Code Block
languagejs
{
    ...
    "isBalanced": true,
    "orientation": "right",
    "implanted": true,
    "isDrop": true,
    "kind": "Splitter",
    "parent": "5da7248311450e0006947b3c",
    "project": "5d9f3ff9200141000647f814",
    "name": "Splitter 1",
    "splitterType": "5b74204cffd4524508626953",
    "createdAt": "2019-10-16T14:09:07.809Z",
    "updatedAt": "2024-11-07T23:58:08.703Z",
    "olt": {
        "label": "4444",
        "port": 22,
        "connectables": [
            "5da61f6a493d9c000666552e",
            "5da61f6a493d9c0006665533",
            "5da722ef11450e0006947aaf"
        ],
        "attenuation": [],
        "implanted": true,
        "isDrop": false,
        "kind": "OLT",
        "parent": "5da61d35493d9c0006665404",
        "project": "5d9f3ff9200141000647f814",
        "oltType": "5cb5d737aacc5e394036ce92",
        "name": "OLT 1",
        "user": "",
        "ip": "192.168.0.2",
        "password": "",
        "createdAt": "2019-10-15T19:35:06.989Z",
        "updatedAt": "2024-12-07T20:55:47.227Z",
        "index": 1,
        "shelf": "5da61f5a493d9c000666552d",
        "size": 1,
        "id": "5da61f6a493d9c000666552f"
    },
    "pon": {
        "connectables": [
            "5da722ef11450e0006947ab7",
            "66bf500450ce3b0014a52913"
        ],
        "maximumClients": null,
        "label": "",
        "attenuation": [],
        "implanted": true,
        "isDrop": false,
        "kind": "PON",
        "name": "2",
        "parent": "5da61d35493d9c0006665404",
        "project": "5d9f3ff9200141000647f814",
        "potency": 2,
        "createdAt": "2019-10-16T14:02:23.973Z",
        "updatedAt": "2024-08-16T13:11:32.332Z",
        "olt": "5da61f6a493d9c000666552f",
        "slot": "5da722ef11450e0006947ab0",
        "id": "5da722ef11450e0006947ab8"
    },
    "slot": {
        "label": "",
        "connectables": [
            "5da722ef11450e0006947aaf",
            "5da722ef11450e0006947ab3",
            "5da722ef11450e0006947ab7",
            "5da722f011450e0006947abb",
            "5da722f011450e0006947abf",
            "5da722f011450e0006947ac3",
            "5da722f011450e0006947ac7",
            "5da722f011450e0006947acb",
            "5da722f011450e0006947acf",
            "5da722f011450e0006947ad3",
            "5da722f011450e0006947ad7",
            "5da722f011450e0006947adb",
            "5da722f011450e0006947adf"
        ],
        "attenuation": [],
        "implanted": true,
        "isDrop": false,
        "kind": "Slot",
        "name": "2",
        "parent": "5da61d35493d9c0006665404",
        "project": "5d9f3ff9200141000647f814",
        "createdAt": "2019-10-16T14:02:23.868Z",
        "updatedAt": "2024-08-16T13:09:50.253Z",
        "starting_pon_number": 1,
        "olt": "5da61f6a493d9c000666552f",
        "id": "5da722ef11450e0006947ab0"
    },
    "id": "5da7248311450e0006947b40"
}

Na resposta, os dados de slot e pon são retornados juntos, permitindo uma visualização mais prática. As propriedades name em ambos os casos indicam que o Splitter está conectado ao Slot de número 2 e à porta PON de número In the response, the olt, slot, and pon data are returned together, providing a more practical view. It can be observed that the Splitter is connected to the OLT named "OLT 1," and it is also possible to see from the name property in the slot and PON that the Splitter is connected to Slot number 2 and PON port number 2.