Saltar al contenido principal

Formato de Respuesta

Horizon entrega respuestas como objetos JSON formateados de acuerdo con HAL. El formato HAL hace que Horizon sea más explorante, pagina las respuestas y conecta recursos padre e hijo. Consumir este formato es simple usando una de las muchas bibliotecas de código abierto disponibles para la mayoría de los principales lenguajes de programación.

HAL es solo JSON con dos nombres de atributo reservados:

  • _links
  • _embedded

Si una respuesta es un único registro, la sección _links proporcionará enlaces a cualquier registro padre o hijo, y no habrá propiedad _embedded.

Si una respuesta es una colección, la sección _links proporcionará enlaces de paginación, y la lista de registros de la respuesta estará anidada debajo de la propiedad _embedded.

  • ATRIBUTOSTIPO DE DATO

    DESCRIPCIÓN

  • _linksarray

    Proporciona enlaces para navegar a otras páginas o a padres e hijos.

  • _embeddedarray

    Presente al consultar un endpoint que responde con una colección de registros.

  • Ejemplo de Respuesta
    {
    "_links": {
    "self": {
    "href": "https://horizon-testnet.stellar.org/accounts/GCRGHKY6RBFVQLF2JCHB7TK7A5BIABITFKVIEOXK4BPEIDE446OEFYXZ/payments?cursor=&limit=5&order=asc"
    },
    "next": {
    "href": "https://horizon-testnet.stellar.org/accounts/GCRGHKY6RBFVQLF2JCHB7TK7A5BIABITFKVIEOXK4BPEIDE446OEFYXZ/payments?cursor=111764193027313665&limit=5&order=asc"
    },
    "prev": {
    "href": "https://horizon-testnet.stellar.org/accounts/GCRGHKY6RBFVQLF2JCHB7TK7A5BIABITFKVIEOXK4BPEIDE446OEFYXZ/payments?cursor=111720727958269953&limit=5&order=desc"
    }
    },
    "_embedded": {
    "records": [
    {
    "_links": {
    "self": {
    "href": "https://horizon-testnet.stellar.org/operations/111720727958269953"
    },
    "transaction": {
    "href": "https://horizon-testnet.stellar.org/transactions/4034838d5b47e4f8c23776faca4d9403637b1f037e436759b57fc892ae5cd96c"
    },
    "effects": {
    "href": "https://horizon-testnet.stellar.org/operations/111720727958269953/effects"
    },
    "succeeds": {
    "href": "https://horizon-testnet.stellar.org/effects?order=desc\u0026cursor=111720727958269953"
    },
    "precedes": {
    "href": "https://horizon-testnet.stellar.org/effects?order=asc\u0026cursor=111720727958269953"
    }
    },
    "id": "111720727958269953",
    "paging_token": "111720727958269953",
    "transaction_successful": true,
    "source_account": "GAR4S3ASZ4HTJ6GQ2DEDLVL4YE6D64UPIOQI4I67L5VPYBGEZDGOI462",
    "type": "create_account",
    "type_i": 0,
    "created_at": "2019-09-26T12:34:24Z",
    "transaction_hash": "4034838d5b47e4f8c23776faca4d9403637b1f037e436759b57fc892ae5cd96c",
    "starting_balance": "20.0000000",
    "funder": "GAR4S3ASZ4HTJ6GQ2DEDLVL4YE6D64UPIOQI4I67L5VPYBGEZDGOI462",
    "account": "GCRGHKY6RBFVQLF2JCHB7TK7A5BIABITFKVIEOXK4BPEIDE446OEFYXZ"
    },
    {
    "_links": {
    "self": {
    "href": "https://horizon-testnet.stellar.org/operations/111721376498331649"
    },
    "transaction": {
    "href": "https://horizon-testnet.stellar.org/transactions/cbf92ce9e2b75b0182597acb1e7c0b58695ec6f69e84a8625c5ab1dda8df31bc"
    },
    "effects": {
    "href": "https://horizon-testnet.stellar.org/operations/111721376498331649/effects"
    },
    "succeeds": {
    "href": "https://horizon-testnet.stellar.org/effects?order=desc\u0026cursor=111721376498331649"
    },
    "precedes": {
    "href": "https://horizon-testnet.stellar.org/effects?order=asc\u0026cursor=111721376498331649"
    }
    },
    "id": "111721376498331649",
    "paging_token": "111721376498331649",
    "transaction_successful": true,
    "source_account": "GAR4S3ASZ4HTJ6GQ2DEDLVL4YE6D64UPIOQI4I67L5VPYBGEZDGOI462",
    "type": "payment",
    "type_i": 1,
    "created_at": "2019-09-26T12:47:50Z",
    "transaction_hash": "cbf92ce9e2b75b0182597acb1e7c0b58695ec6f69e84a8625c5ab1dda8df31bc",
    "asset_type": "native",
    "from": "GAR4S3ASZ4HTJ6GQ2DEDLVL4YE6D64UPIOQI4I67L5VPYBGEZDGOI462",
    "to": "GCRGHKY6RBFVQLF2JCHB7TK7A5BIABITFKVIEOXK4BPEIDE446OEFYXZ",
    "amount": "5000.0000000"
    },
    {
    "_links": {
    "self": {
    "href": "https://horizon-testnet.stellar.org/operations/111722218311925761"
    },
    "transaction": {
    "href": "https://horizon-testnet.stellar.org/transactions/9fcf20d23862f40cd8a59f0ad0247a7d56a1b38cb79e4953b5aad8df5f2608a7"
    },
    "effects": {
    "href": "https://horizon-testnet.stellar.org/operations/111722218311925761/effects"
    },
    "succeeds": {
    "href": "https://horizon-testnet.stellar.org/effects?order=desc\u0026cursor=111722218311925761"
    },
    "precedes": {
    "href": "https://horizon-testnet.stellar.org/effects?order=asc\u0026cursor=111722218311925761"
    }
    },
    "id": "111722218311925761",
    "paging_token": "111722218311925761",
    "transaction_successful": true,
    "source_account": "GBSIPZRLSM2KMLUZYEGKU2WMA6HPEE3NGB47YY4MLK43ISLLCJKFA2F2",
    "type": "payment",
    "type_i": 1,
    "created_at": "2019-09-26T13:05:12Z",
    "transaction_hash": "9fcf20d23862f40cd8a59f0ad0247a7d56a1b38cb79e4953b5aad8df5f2608a7",
    "asset_type": "native",
    "from": "GBSIPZRLSM2KMLUZYEGKU2WMA6HPEE3NGB47YY4MLK43ISLLCJKFA2F2",
    "to": "GCRGHKY6RBFVQLF2JCHB7TK7A5BIABITFKVIEOXK4BPEIDE446OEFYXZ",
    "amount": "10.0000000"
    },
    {
    "_links": {
    "self": {
    "href": "https://horizon-testnet.stellar.org/operations/111747107647434753"
    },
    "transaction": {
    "href": "https://horizon-testnet.stellar.org/transactions/44af49d32061cdb352d131559560559e7be815b16c45412b7682600c71224623"
    },
    "effects": {
    "href": "https://horizon-testnet.stellar.org/operations/111747107647434753/effects"
    },
    "succeeds": {
    "href": "https://horizon-testnet.stellar.org/effects?order=desc\u0026cursor=111747107647434753"
    },
    "precedes": {
    "href": "https://horizon-testnet.stellar.org/effects?order=asc\u0026cursor=111747107647434753"
    }
    },
    "id": "111747107647434753",
    "paging_token": "111747107647434753",
    "transaction_successful": true,
    "source_account": "GCRGHKY6RBFVQLF2JCHB7TK7A5BIABITFKVIEOXK4BPEIDE446OEFYXZ",
    "type": "payment",
    "type_i": 1,
    "created_at": "2019-09-26T21:43:41Z",
    "transaction_hash": "44af49d32061cdb352d131559560559e7be815b16c45412b7682600c71224623",
    "asset_type": "credit_alphanum4",
    "asset_code": "BTC",
    "asset_issuer": "GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH",
    "from": "GCRGHKY6RBFVQLF2JCHB7TK7A5BIABITFKVIEOXK4BPEIDE446OEFYXZ",
    "to": "GBSIPZRLSM2KMLUZYEGKU2WMA6HPEE3NGB47YY4MLK43ISLLCJKFA2F2",
    "amount": "0.0000709"
    },
    {
    "_links": {
    "self": {
    "href": "https://horizon-testnet.stellar.org/operations/111764193027313665"
    },
    "transaction": {
    "href": "https://horizon-testnet.stellar.org/transactions/7bd57f8cc75ce2d9740568eade9700cd7b19491a2c938232e5b3f0768f3e588a"
    },
    "effects": {
    "href": "https://horizon-testnet.stellar.org/operations/111764193027313665/effects"
    },
    "succeeds": {
    "href": "https://horizon-testnet.stellar.org/effects?order=desc\u0026cursor=111764193027313665"
    },
    "precedes": {
    "href": "https://horizon-testnet.stellar.org/effects?order=asc\u0026cursor=111764193027313665"
    }
    },
    "id": "111764193027313665",
    "paging_token": "111764193027313665",
    "transaction_successful": true,
    "source_account": "GCRGHKY6RBFVQLF2JCHB7TK7A5BIABITFKVIEOXK4BPEIDE446OEFYXZ",
    "type": "payment",
    "type_i": 1,
    "created_at": "2019-09-27T03:37:57Z",
    "transaction_hash": "7bd57f8cc75ce2d9740568eade9700cd7b19491a2c938232e5b3f0768f3e588a",
    "asset_type": "credit_alphanum4",
    "asset_code": "BTC",
    "asset_issuer": "GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH",
    "from": "GCRGHKY6RBFVQLF2JCHB7TK7A5BIABITFKVIEOXK4BPEIDE446OEFYXZ",
    "to": "GBSIPZRLSM2KMLUZYEGKU2WMA6HPEE3NGB47YY4MLK43ISLLCJKFA2F2",
    "amount": "0.0107156"
    }
    ]
    }
    }