LogoLogo
  • Welcome
  • Where to Start
    • Introduction
    • list of Operations
    • Bantu Stack
  • Tutorials
    • Create Account
    • Send and Receive Payments
    • Follow Received Payments
    • Securing Web-based Projects
  • Issue Assets
    • Overview
    • Anatomy of an Asset
    • Issue an Asset
    • Publish Information About an Asset
    • Control Access to an Asset
  • Building Apps
    • Overview
    • Project Setup
    • Key Management Basics
    • Create a Basic Wallet
    • Make XBN Payments
    • Handle Custom Assets
  • Run a Core Node
    • index
    • running-node
    • network-upgrades
    • tier-1-orgs
    • installation
    • prerequisites
    • configuring
    • publishing history archives
    • commands
    • monitoring
  • Run API Server
    • prerequisites
    • quickstart
    • index
    • installing
    • monitoring
    • Running
    • configuring
  • Software and SDKs
    • index
  • Glossary
    • scp
    • Claimable Balance
    • XDR
    • Assets
    • BUDS
    • Inflation
    • Miscellaneous Core Objects
    • Testnet
    • Accounts
    • Network Passphrase
    • Ledger
    • Versioning
    • Sponsored Reserves
    • Operations
    • Decentralized Exchange
    • Fees
    • XBN Supply
    • Fee Bumps
    • Channels
    • Transactions
    • Minimum Balance
    • Multisig
  • Docs
    • Index
  • API
    • Introduction
      • Index
      • Response Format
      • Streaming
      • Rate Limiting
      • XDR
      • Pagination
        • Index
        • Page Arguments
    • Resources
      • Untitled
      • Overview
      • Ledgers
        • index
        • Object
        • Single
        • Transactions
        • Operations
        • Payments
        • Effects
        • List
      • Transactions
        • Index
        • Object
        • Single
        • Operations
        • Effects
        • List
      • Operations
        • Index
        • Object
          • Index
          • Create Account
          • Payment
          • Path Payment Strict Send
          • Path Payment Strict Receive
          • Sell Offer
          • Buy Offer
          • Passive Sell Offer
          • Set Options
          • Change Trust
          • Allow Trust
          • Account Merge
          • Manage Data
          • Bump Sequence
          • Create Claimable Balance
          • Claim Claimable Balance
          • Begin Sponsoring Future Reserves
          • End Sponsoring Future Reserves
          • Revoke Sponsorship
        • Single
        • Effects
        • List
        • List Payments
      • Effects
        • Index
        • Types
        • List
      • Accounts
        • Index
        • Object
        • Transactions
        • List
        • Single
        • Operations
        • Payments
        • Effects
        • Offers
        • Trades
        • Data
      • Offers
        • Index
        • Object
        • Single
        • List
      • Trades
        • Index
        • Object
        • List
      • Assets
        • Index
        • Object
        • List
      • Claimable Balances
        • Index
        • Object
        • Single
        • List
    • Aggregations
      • Index
      • Order Books
        • Index
        • object
        • Single
      • Paths
        • Index
        • Object
        • Strict Receive
        • Strict Send
      • Trade Aggregations
        • Index
        • Object
        • List
      • Fee Stats
        • Index
        • Object
        • Single
    • Errors
      • Index
      • Response
      • HTTP Status Codes
        • Index
        • Standard
        • Expansion Specific
          • Index
          • Transaction Failed
          • Transaction Malformed
          • Before History
          • Stale History
          • Timeout
      • Result Codes
        • Index
        • Transactions
        • Operations
        • Operation Specific
          • Index
          • Create Account
          • Payment
          • Path Payment Strict Receive
          • Path Payment Strict Send
          • Manage Sell Offer
          • Manage Buy Offer
          • Create Passive Sell Offer
          • Set Options
          • Change Trust
          • Allow Trust
          • Account Merge
          • Manage Data
          • Bump Sequence
Powered by GitBook
On this page

Was this helpful?

  1. API
  2. Introduction
  3. Pagination

Index

To make it possible to explore the millions of records for resources like transactions and operations, Horizon paginates the data it returns for collection-based endpoints.

Each individual transaction, operation, ledger, etc. is returned as a record, and a group of records is called a collection. Records are returned as an array under the _embedded attribute.

To move between pages of a collection of records, use the links in the next and prev attributes nested under the top-level _links attribute.

  • ATTRIBUTE DATA TYPE

    DESCRIPTION

  • _linksarray

    Provides links for navigating to other pages.Hide child attributes

    • _links.selfarray

      An href key with a link to the response itself as the value.

    • _links.nextarray

      An href key with a link to the next page for this endpoint as the value.

    • _links.prevarray

      An href key with a link to the next page for this endpoint as the value.

  • _embeddedarray

    An href key with a link to the next page for this endpoint as the value.Hide child attributes

    • _embedded.recordsarray

      Returns an array of records.

var StellarSdk = require("stellar-sdk");
var server = new StellarSdk.Server("https://horizon.stellar.org");

server
  .transactions()
  .call()
  .then(function (resp) {
    // page 1
    console.log(resp);
    return resp.next();
  })
  .then(function (resp) {
    // page 2
    console.log(resp);
  })
  .catch(function (err) {
    console.error(err);
  });
{
  "_links": {
    "self": {
      "href": "https://horizon.stellar.org/transactions/2a09c3d79027721f2b8a78e2a936cbeda484bfe98a6e34856c1fee743b7e8906/operations?cursor=&limit=5&order=asc"
    },
    "next": {
      "href": "https://horizon.stellar.org/transactions/2a09c3d79027721f2b8a78e2a936cbeda484bfe98a6e34856c1fee743b7e8906/operations?cursor=113928152169844741&limit=5&order=asc"
    },
    "prev": {
      "href": "https://horizon.stellar.org/transactions/2a09c3d79027721f2b8a78e2a936cbeda484bfe98a6e34856c1fee743b7e8906/operations?cursor=113928152169844737&limit=5&order=desc"
    }
  },
  "_embedded": {
    "records": [
      {
        "_links": {
          "self": {
            "href": "https://horizon.stellar.org/operations/113928152169844737"
          },
          "transaction": {
            "href": "https://horizon.stellar.org/transactions/2a09c3d79027721f2b8a78e2a936cbeda484bfe98a6e34856c1fee743b7e8906"
          },
          "effects": {
            "href": "https://horizon.stellar.org/operations/113928152169844737/effects"
          }
        },
        "id": "113928152169844737",
        "paging_token": "113928152169844737",
        "transaction_successful": true,
        "source_account": "GDO2BIMNH7T6MOJVPKEJHWAGMYGOQU5QMK5BKT5XMVWPZKHAGA4JNAQZ",
        "type": "manage_buy_offer",
        "type_i": 12,
        "created_at": "2019-10-28T19:44:09Z",
        "transaction_hash": "2a09c3d79027721f2b8a78e2a936cbeda484bfe98a6e34856c1fee743b7e8906",
        "amount": "0.0000000",
        "price": "0.0001000",
        "price_r": {
          "n": 1,
          "d": 10000
        },
        "buying_asset_type": "native",
        "selling_asset_type": "credit_alphanum4",
        "selling_asset_code": "SLT",
        "selling_asset_issuer": "GCKA6K5PCQ6PNF5RQBF7PQDJWRHO6UOGFMRLK3DYHDOI244V47XKQ4GP",
        "offer_id": 126229445
      },
      {
        "_links": {
          "self": {
            "href": "https://horizon.stellar.org/operations/113928152169844738"
          },
          "transaction": {
            "href": "https://horizon.stellar.org/transactions/2a09c3d79027721f2b8a78e2a936cbeda484bfe98a6e34856c1fee743b7e8906"
          },
          "effects": {
            "href": "https://horizon.stellar.org/operations/113928152169844738/effects"
          },
          "succeeds": {
            "href": "https://horizon.stellar.org/effects?order=desc\u0026cursor=113928152169844738"
          },
          "precedes": {
            "href": "https://horizon.stellar.org/effects?order=asc\u0026cursor=113928152169844738"
          }
        },
        "id": "113928152169844738",
        "paging_token": "113928152169844738",
        "transaction_successful": true,
        "source_account": "GDO2BIMNH7T6MOJVPKEJHWAGMYGOQU5QMK5BKT5XMVWPZKHAGA4JNAQZ",
        "type": "manage_buy_offer",
        "type_i": 12,
        "created_at": "2019-10-28T19:44:09Z",
        "transaction_hash": "2a09c3d79027721f2b8a78e2a936cbeda484bfe98a6e34856c1fee743b7e8906",
        "amount": "0.0000000",
        "price": "0.0001000",
        "price_r": {
          "n": 1,
          "d": 10000
        },
        "buying_asset_type": "native",
        "selling_asset_type": "credit_alphanum4",
        "selling_asset_code": "SLT",
        "selling_asset_issuer": "GCKA6K5PCQ6PNF5RQBF7PQDJWRHO6UOGFMRLK3DYHDOI244V47XKQ4GP",
        "offer_id": 126229446
      },
      {
        "_links": {
          "self": {
            "href": "https://horizon.stellar.org/operations/113928152169844739"
          },
          "transaction": {
            "href": "https://horizon.stellar.org/transactions/2a09c3d79027721f2b8a78e2a936cbeda484bfe98a6e34856c1fee743b7e8906"
          },
          "effects": {
            "href": "https://horizon.stellar.org/operations/113928152169844739/effects"
          },
          "succeeds": {
            "href": "https://horizon.stellar.org/effects?order=desc\u0026cursor=113928152169844739"
          },
          "precedes": {
            "href": "https://horizon.stellar.org/effects?order=asc\u0026cursor=113928152169844739"
          }
        },
        "id": "113928152169844739",
        "paging_token": "113928152169844739",
        "transaction_successful": true,
        "source_account": "GDO2BIMNH7T6MOJVPKEJHWAGMYGOQU5QMK5BKT5XMVWPZKHAGA4JNAQZ",
        "type": "manage_buy_offer",
        "type_i": 12,
        "created_at": "2019-10-28T19:44:09Z",
        "transaction_hash": "2a09c3d79027721f2b8a78e2a936cbeda484bfe98a6e34856c1fee743b7e8906",
        "amount": "0.0000000",
        "price": "0.0001000",
        "price_r": {
          "n": 1,
          "d": 10000
        },
        "buying_asset_type": "native",
        "selling_asset_type": "credit_alphanum4",
        "selling_asset_code": "SLT",
        "selling_asset_issuer": "GCKA6K5PCQ6PNF5RQBF7PQDJWRHO6UOGFMRLK3DYHDOI244V47XKQ4GP",
        "offer_id": 126229447
      },
      {
        "_links": {
          "self": {
            "href": "https://horizon.stellar.org/operations/113928152169844740"
          },
          "transaction": {
            "href": "https://horizon.stellar.org/transactions/2a09c3d79027721f2b8a78e2a936cbeda484bfe98a6e34856c1fee743b7e8906"
          },
          "effects": {
            "href": "https://horizon.stellar.org/operations/113928152169844740/effects"
          },
          "succeeds": {
            "href": "https://horizon.stellar.org/effects?order=desc\u0026cursor=113928152169844740"
          },
          "precedes": {
            "href": "https://horizon.stellar.org/effects?order=asc\u0026cursor=113928152169844740"
          }
        },
        "id": "113928152169844740",
        "paging_token": "113928152169844740",
        "transaction_successful": true,
        "source_account": "GDO2BIMNH7T6MOJVPKEJHWAGMYGOQU5QMK5BKT5XMVWPZKHAGA4JNAQZ",
        "type": "manage_buy_offer",
        "type_i": 12,
        "created_at": "2019-10-28T19:44:09Z",
        "transaction_hash": "2a09c3d79027721f2b8a78e2a936cbeda484bfe98a6e34856c1fee743b7e8906",
        "amount": "0.0000000",
        "price": "0.0001000",
        "price_r": {
          "n": 1,
          "d": 10000
        },
        "buying_asset_type": "native",
        "selling_asset_type": "credit_alphanum4",
        "selling_asset_code": "SLT",
        "selling_asset_issuer": "GCKA6K5PCQ6PNF5RQBF7PQDJWRHO6UOGFMRLK3DYHDOI244V47XKQ4GP",
        "offer_id": 126229448
      },
      {
        "_links": {
          "self": {
            "href": "https://horizon.stellar.org/operations/113928152169844741"
          },
          "transaction": {
            "href": "https://horizon.stellar.org/transactions/2a09c3d79027721f2b8a78e2a936cbeda484bfe98a6e34856c1fee743b7e8906"
          },
          "effects": {
            "href": "https://horizon.stellar.org/operations/113928152169844741/effects"
          },
          "succeeds": {
            "href": "https://horizon.stellar.org/effects?order=desc\u0026cursor=113928152169844741"
          },
          "precedes": {
            "href": "https://horizon.stellar.org/effects?order=asc\u0026cursor=113928152169844741"
          }
        },
        "id": "113928152169844741",
        "paging_token": "113928152169844741",
        "transaction_successful": true,
        "source_account": "GDO2BIMNH7T6MOJVPKEJHWAGMYGOQU5QMK5BKT5XMVWPZKHAGA4JNAQZ",
        "type": "manage_buy_offer",
        "type_i": 12,
        "created_at": "2019-10-28T19:44:09Z",
        "transaction_hash": "2a09c3d79027721f2b8a78e2a936cbeda484bfe98a6e34856c1fee743b7e8906",
        "amount": "0.0000000",
        "price": "0.0001000",
        "price_r": {
          "n": 1,
          "d": 10000
        },
        "buying_asset_type": "native",
        "selling_asset_type": "credit_alphanum4",
        "selling_asset_code": "SLT",
        "selling_asset_issuer": "GCKA6K5PCQ6PNF5RQBF7PQDJWRHO6UOGFMRLK3DYHDOI244V47XKQ4GP",
        "offer_id": 126229449
      }
    ]
  }
}
PreviousPaginationNextPage Arguments

Last updated 4 years ago

Was this helpful?