Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
June 8, 2022 12:16 pm GMT

Getting started with the Search API

What youll learn

If youve worked with the Stripe API before, you know that you can retrieve your resources like Customers and Payment Intents by using list API endpoints and then paging through the resulting data. You may have even used the really useful auto-pagination features that are included in all of our officially supported client libraries to page and filter objects to be used in your system.

In this episode youll learn how to leverage the new Search API and its comprehensive query language to query the API directly for your Stripe resources. This new API enables you to build complex interfaces to your data. For example, you might want to build a search tool for listing failed Charges, or Customers with a specific email address for support cases.

Now for searchable resources, you can issue a search query in one API call and retrieve the objects youre interested in. Heres a simple example in Ruby:

results = Stripe::PaymentIntent.search(query: 'amount:1000')results.each do |result|  p %(#{result.id} #{result.amount} #{result.currency})end

Auto-pagination is also available on search results using our client libraries.

Prerequisites

If youd like to follow along, youll need a Stripe account which you can sign up for here.

Table of contents

What to watch next

To learn about auto-pagination there is a list of videos in many languages on our YouTube channel.

Stay connected

In addition, you can stay up to date with Stripe in a few ways:

Follow us on Twitter
Join the official Discord server
Subscribe to our Youtube channel
Sign up for the Dev Digest
Author @mattling_dev


Original Link: https://dev.to/stripe/getting-started-with-the-search-api-48la

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To