sorare / api

Sorare API documentation
153 stars 47 forks source link

Transfermarket singlesaleoffers not working most of time #253

Open satonio opened 2 years ago

satonio commented 2 years ago

query { transferMarket { singleSaleOffers (last: 50) { nodes { id price endDate blockchainId card { id } } pageInfo { startCursor endCursor hasPreviousPage } } } }

Most of times it returns: {"data":null,"errors":[{"message":"Cannot return null for non-nullable field SingleSaleOffer.card"}]}

It might be related with baseball update. Maybe it fails if there is any card from baseball.

feikede commented 2 years ago

Also have this a lot of times. Could hunt it down to the "last" value. Always happens with > 25. Never happens i.e. with =10

feikede commented 2 years ago

Using this for test:

query TestQuery($first:Int!, $afterCursor:String!)
{ transferMarket
{  singleSaleOffers(first:$first, after:$afterCursor) { pageInfo { endCursor, hasNextPage},
    nodes {card{slug}, createdAt,cancelledAt, endDate}
}
}}

With first = 10, after 4-6 cursor steps I get Cannot return null for non-nullable field SingleSaleOffer.card Using a JWT-AUD Token, btw.

Should I retry with a delay?

Thanks.

feikede commented 2 years ago

When I start over with afterCursor="" after a delay of 30 secs. It works again (with new cards) for about 3-7 cursor steps. What's the intended use of this API to fetch all cards from the singleSale-TransferMarket? Like on the UI (Manager Sales, "Newly Listed").

Thanks anyway for the great product and the open gql API !!! Love it

using-system commented 2 years ago

This "Cannot return null for non-nullable field SingleSaleOffer.card" error has been occurring since MLB was published.

the error probably happens when in the returned batch there is an MLB card (card is null because MLB has its own entity, card is for football)

feikede commented 2 years ago

Good hint, then they should add sport: [Sport!] restriction to signature in schema.graphql

singleSaleOffers(
    # Returns the elements in the list that come after the specified cursor.
    after: String

    # Returns the elements in the list that come before the specified cursor.
    before: String

    # Returns the first _n_ elements from the list.
    first: Int

    # Returns the last _n_ elements from the list.
    last: Int
  ): SingleSaleOfferConnection!
ottopic commented 2 years ago

I have the same problem, but I don't understand what is workaround to iterate lists. What kind of string is expected in after param ?

using-system commented 2 years ago

No really workaround unfortunately I think while waiting for a fix on the API side by Sorare IT team

And while waiting for the fix

Reduce the last parameter (10) to minimize the possibility to have an MLB card in the response that throw the"Cannot return null for non-nullable field SingleSaleOffer.card error"

ottopic commented 2 years ago

Ok thanks. Do you know about "forum" where is possibile to write about Sorare API and get help about queries?

using-system commented 2 years ago

Nop bup the best place to have info / doc for queries is : https://api.sorare.com/graphql/playground (docs tab)

feikede commented 2 years ago

Maybe we can get an API channel in sorare's discord for discussion and help? That would be cool.