Okay, das folgende Beispiel zeigt Dir alle Textbooks des Verlags Open Book Publishers (mit weiteren Erläuterungen unseres Devs Brendan O’Connell):
{ "query": "query GetTextbooks($publishers: [Uuid!]) { works(workTypes: TEXTBOOK, publishers: $publishers) { fullTitle doi } }", "variables": { "publishers": ["85fd969a-a16c-480b-b641-cb9adf979c3b"] }
to test out seeing the output of this from a POST request, they could run this in any command line application (e.g. Terminal on Mac):
curl -X POST https://api.thoth.pub/graphql \ -H "Content-Type: application/json" \ -d '{ "query": "query GetTextbooks($publishers: [Uuid!]) { works(workTypes: TEXTBOOK, publishers: $publishers) { fullTitle doi } }", "variables": { "publishers": ["85fd969a-a16c-480b-b641-cb9adf979c3b"] } }’
this is the equivalent of the below query using the GraphiQL Explorer on our website (https://api.thoth.pub/graphiql):
query GetTextbooks($publishers: [Uuid!]) { works(workTypes: TEXTBOOK, publishers: $publishers) { fullTitle doi } }
Variables: { "publishers": ["85fd969a-a16c-480b-b641-cb9adf979c3b"] }
Zur Limitierung: aktuell haben wir kein Limit, werden aber in naher Zukunft eines einführen, um übermäßige Nutzung der API im Rahmen zu halten. Die Query wirft standarmäßig bis zu 100 Ergebnisse aus, dies kan über einen Parameter erweitert werden:
modified query below with limit: 99999 added to capture all results if there are more than 100:
curl -X POST https://api.thoth.pub/graphql \ -H "Content-Type: application/json" \ -d '{ "query": "query GetTextbooks($publishers: [Uuid!]) { works(workTypes: TEXTBOOK, publishers: $publishers, limit: 99999) { fullTitle doi } }", "variables": { "publishers": ["85fd969a-a16c-480b-b641-cb9adf979c3b"] } }'