LogoLogo
Request an API keyBack to Craft.co
  • Introduction
  • About GraphQL
  • Authentication
  • Troubleshooting
  • Company Data API
    • Company Data API Introduction
    • Getting started
      • Getting started with JavaScript
      • Getting started with Python
      • Getting started with Ruby
      • Getting started with cURL
    • Query Parameters
    • Data Categories
      • Basic Company Information
        • USG Prohibited List
        • Security Rating
        • Gov Spending
        • Unspsc Code
        • Patent
        • Stock Market
        • Tag
      • Financials
        • Private Valuation
        • Funding Rounds
        • Income Statement
        • Cash Flow Statement
        • Balance Sheet
        • Revenue Breakdown
        • Acquisitions
        • Analyst Ratings
        • Filing
        • Stock Summary
        • Latest Z Score
        • Ratios
      • Human capital
        • Company Ratings
        • Employee Numbers
        • Human Capital Metrics
        • Job Categories
        • Jobs
        • Key Executives
        • Salaries
      • Operating data
        • Locations
        • Data Breaches
        • Competitors
        • Blacklists
        • Twitter Engagement
        • News Articles
        • Operating Metrics (KPIs)
        • Sentiment Breakdowns
          • Sentiment Breakdown Item
            • Sentiment External Item
        • Sustainability Metrics
        • Technology Stack
        • Twitter Followers
        • Court Filings
        • Patents
        • Products and Services
        • Government Spending
        • Website Traffic
        • Compliance Data
        • Risks
    • GraphQL Enums
      • Unspsc Code Level Enum
      • Company Status Enum
      • Company Type Enum
      • Currency Type Enum
      • Metric Unit Enum
      • Period Type Enum
      • Sentiment Breakdown Type Enum
    • Core data types
      • String
      • Money Object
      • Source Object
      • Image Object
      • Period Object
      • Time Frame
      • AcurisAddress
      • AcurisAlias
      • AcurisBusinessLink
      • AcurisContactEntry
      • AcurisEvidence
      • AcurisGriEntry
      • AcurisIdentifier
      • AcurisIndividualLink
      • AcurisInsEntry
      • AcurisNote
      • AcurisPoiEntry
      • AcurisPosition
      • AcurisRegime
      • AcurisRelEntry
      • AcurisRelEvent
      • AcurisRelEventPeriod
      • AcurisRreEntry
      • AcurisRreEvent
      • AcurisSanEntries
      • AcurisSanEntry
      • AcurisSanEvent
      • AcurisSoeEntry
      • AcurisPepEntry
      • AcurisStatus
      • Risk
      • AdditionalInfo
      • RiskRating
      • RiskHighlight
      • RiskRatingInt
      • RiskRatingIntData
      • RiskRatingIntScaleItem
      • RiskRatingIntValueRange
      • RiskRatingFloat
      • RiskRatingFloatData
      • RiskRatingFloatScaleItem
      • RiskRatingFloatValueRange
      • ColorLinearGradient
      • RiskRatingString
      • RiskRatingStringData
      • RiskRatingStringScaleItem
    • Additional data types
      • PageInfo
    • Query examples
    • Restrictions on Usage
    • Usage
  • Added Companies API
    • Newly Profiled Companies API Introduction
    • Query
      • Basic Company
  • Alerts API
    • Alerts API Introduction
    • Getting started
      • Getting started with JavaScript
      • Getting started with Python
      • Getting started with Ruby
      • Getting started with cURL
    • Alerts API Queries
      • Pagination
      • Filtering and sorting
    • Alerts API Reference
      • Alert Object
      • Filter Object
      • Order Object
      • Payload Object
    • Query examples
    • Restrictions on Usage
Powered by GitBook
On this page

Was this helpful?

  1. Alerts API
  2. Alerts API Queries

Pagination

This guide will help you get started with fetching sequences of Alerts from the Alerts API

Depending on the use-case, there might be a need to fetch more than 100 entities from the Alerts API for local data processing. For such scenarios, Alerts API implements id-based cursor pagination.

Example

Let's assume we have the following set of Alerts available in the API:

[
  {
    "id": "05978d3a-0a49-8b63-b054-b65d37e4eb05"
  },
  {
    "id": "9b8a3e5d-b7e5-0a67-7788-96d98349407b"
  },
  {
    "id": "030bd54a-745b-9d6d-33d7-e683a0ee7389"
  },
]

Running the following GraphQL query would return the very first of the three Alerts:

query getAlerts {
  alerts(first: 1) {
    id
  }
}
[
  {
    "id": "05978d3a-0a49-8b63-b054-b65d37e4eb05"
  },
]

Since this response contains the same amount of items as was requested with the first argument, we can assume there are more Alerts available for the same query.

To fetch the next page, it's possible to specify after argument on the alerts node which accepts a valid Alert ID. It instructs the API to return all the entities following the one with the given ID.

Running the same query, but with after argument:

query getAlerts {
  alerts(first: 1, after: "05978d3a-0a49-8b63-b054-b65d37e4eb05") {
    id
  }
}

Will return the second Alert from the initial group.

[
  {
    "id": "9b8a3e5d-b7e5-0a67-7788-96d98349407b"
  },
]

after argument can be combined with any other arguments available on the alerts node, including orderBy

If we'll run the same query, using last Alert's ID, it'll return the empty array:

[]

This indicates that we have paginated through all available entities and there are no more Alerts left.

PreviousAlerts API QueriesNextFiltering and sorting

Last updated 4 years ago

Was this helpful?