#soma - product search API
1 messages · Page 1 of 1 (latest)
product object has a created field, right?
Gotcha. I know that the list call allows for filtering on this field. As you note our docs don't list created as being a searchable field at the moment. It may still be worth trying to just pass in created>1620310503 or something to see if it works but is undocumented https://stripe.com/docs/api/products/list#list_products-created
If that errors out then it is definitely not supported and I can raise a feature request.
thank you, I will try it right now and will be back to you with feedback
Field created is an unsupported search field for resource products. See http://stripe.com/docs/search#query-fields-for-products for a list of supported fields.
right now it won't allow filtering by created field, it would be nice to have this feature
Gotcha. Yep will add it. If you really need this in the meantime you can may be able to just set created as metadata on the product and filter by that.
Of course, what is your question?
according to this https://stripe.com/docs/api/products/search, what is the starting number for the page parameter? I am assuming 0, is that right?
I think you are expected to leave it out or pass in an empty string on your first call
Is your call failing without it?
yes
but the next_page returned in the response is kind of id
sorry if I ask a lot, but documentation is dense sometimes
Right, I think the first page doesn't have a number and after that the ID is what you use to show where to start from for subsequent calls.
Can you explain a bit more what you are looking in to here?
so, that Id is what I need to pass to the next page, right?
it doesn't make any sense because pagination have a previous and next navigation, so I think this should be a number
and the api is only returning a next_page and a has_more...
not a previous_page, or a has_less
Yes that ID is what you pass in to get the next page
A cursor for pagination across multiple pages of results. Don’t include this parameter on the first call. Use the
next_pagevalue returned in a previous response to request subsequent results.
https://stripe.com/docs/api/products/search#search_products-page
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
has_more here simply means that there is at least one more product that would be returned and you need to check the next page
ok, but suppose my pagination is 10 rows per page and I have 1000 products
how to return to the page 4 from page 5?
Have you tried auto-pagination here? I don't know if it works with the search API but it might make it easier to get all of these with less code on your side https://stripe.com/docs/api/pagination/auto
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
You would need to record the previous page ID yourself. You can pass it in to the API again if you want to retrieve that page again
the thing is I need to paginate and to filter
Right, that will be the final solution
thanks for your response
I will store the prev and next id, have a nice day
Of course, have a nice day yourself!