#soma - product search API

1 messages · Page 1 of 1 (latest)

slim igloo
#

Hello, happy to help look in to this. What do you mean by "the creation item" here?

crimson lily
#

product object has a created field, right?

slim igloo
#

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.

crimson lily
#

thank you, I will try it right now and will be back to you with feedback

#

right now it won't allow filtering by created field, it would be nice to have this feature

slim igloo
#

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.

crimson lily
#

I think so

#

thanks

#

Mr. @slim igloo one question, can I?

slim igloo
#

Of course, what is your question?

crimson lily
slim igloo
#

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?

crimson lily
#

yes

#

but the next_page returned in the response is kind of id

#

sorry if I ask a lot, but documentation is dense sometimes

slim igloo
#

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?

crimson lily
#

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

slim igloo
#

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_page value returned in a previous response to request subsequent results.
https://stripe.com/docs/api/products/search#search_products-page

#

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

crimson lily
#

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?

slim igloo
#

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

crimson lily
#

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

slim igloo
#

Of course, have a nice day yourself!