Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

JSON api for 5e SRD?

Hello, is there an query API for the 5e SRD that will return the results in json?
1474153894

Edited 1474153958
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
The API does not have access to the compendium. It can only get information from and modify information of entities in the game. What are you trying to do? There may be another way. Also, the API is only accessible in games created by Pro level members.
1474155245
The Aaron
Roll20 Production Team
API Scripter
Just a quick separation of concepts: The Roll20 API scripts do not have access to the compendium.&nbsp; Roll20 provides a free community accessible online SRD API.&nbsp; From:&nbsp; <a href="https://app.roll20.net/forum/post/2877778/update-1" rel="nofollow">https://app.roll20.net/forum/post/2877778/update-1</a>... Open and community-driven. Our goal is to provide a resource that the whole community can freely use. Anyone can apply to help edit the Compendium and keep it up to date, and all of our data is freely available in JSON format; for example, here’s the Fireball entry: <a href="https://app.roll20.net/compendium/dnd5e/Fireball.json" rel="nofollow">https://app.roll20.net/compendium/dnd5e/Fireball.json</a> . So the next time someone wants to build a tool like an encounter builder or a spell list, they can pull from this data quickly and easily.
1474156111
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
And, so I show my programming inexperience. Thanks for the correction Aaron.
1474157248
The Aaron
Roll20 Production Team
API Scripter
Your statement was correct, you just weren't aware of the Compendium API. It's not accessible in the Roll20 API, just like you said. :)
1474170977

Edited 1474171090
Thanks, I'm referring specifically to the second 'API', for the SRD. &nbsp;I'm not trying to access it from the Roll20 API, I'm asking if there is a query API for the SRD data. &nbsp;As in, the ability to create a query/hit endpoints on the SRD that will return the requested data in json format and not simply provide individual entries as json. &nbsp;If there is an API, is it documented somewhere? Essentially, how does one access the SRD data so that "the next time someone wants to build a tool like an encounter builder or a spell list, they can pull from this data quickly and easily." Thanks,
1474206815
The Aaron
Pro
API Scripter
There is nothing documented, but you can use this endpoint to get search results in JSON format: <a href="https://roll20.net/compendium/compendium/globalsearch/dnd5e?terms=" rel="nofollow">https://roll20.net/compendium/compendium/globalsearch/dnd5e?terms=</a> misty [{"value":"Misty Step","category":"Spells","pagename":"Misty Step","score":10,"pageid":11483,"groupbyvalue":"Misty Step"},{"value":"Misty Visions","category":"Classes","pagename":"Warlock","score":7,"pageid":5209,"groupbyvalue":"Misty Visions"}]
Thanks for the response aaron. &nbsp;Unfortunately that's not very useable :(
1474344527
The Aaron
Pro
API Scripter
Oh? &nbsp;Sorry to hear that. &nbsp;It's not REST compliant, but it seems like it gives the results you would need to build the page url: <a href="https://roll20.net/compendium/dnd5e/{category}:{pagename}.json" rel="nofollow">https://roll20.net/compendium/dnd5e/{category}:{pagename}.json</a> What more are you looking for?
1474357397

Edited 1474357483
Sorry, that wasn't intended to be inflammatory. &nbsp;That last detail is helpful. &nbsp;As an example, It would be helpful to be able to get an index of all spells by class. &nbsp;Well an example of that is "Wizard spells by name", which that search feature exposes as `category:Rules` and `pagename: Wizard Spells By Name`. &nbsp;But, when I go to that page, the content is the list I'm looking for but can't use, and the `.json` returns just the search index ``` { name: "Wizard Spells by Name", id: 7047, content: "{{SearchIndex|Category:Spells Classes:*Wizard|Summarize,AdditionalAttributes:School,}}", data: { Category: "Rules" } } ``` Where I am looking for an actual array of wizard spells in json
1474377272
The Aaron
Pro
API Scripter
=D &nbsp;Sorry, I'm never inflamed, just tired. &nbsp; I see what you mean. &nbsp;Finding individual things by searching works, but getting additional indexes doesn't. &nbsp;Probably you'd have to build your own index by pulling all spells and parsing the Classes property, not ideal. &nbsp;Maybe there's something else, I'll see what I can find.
Thanks! You mention "you'd have to build&nbsp;your own index by pulling all spells". &nbsp;Is there a way to do that in one call? &nbsp;Even if there was a way to get all objects for a category in a json array (ie. spells, monsters, classes(?) equipment), then that would be a good starting point.
1474595383
The Aaron
Pro
API Scripter
It looks to me like if you do this: <a href="https://roll20.net/compendium/compendium/globalsearch/dnd5e\?terms\=" rel="nofollow">https://roll20.net/compendium/compendium/globalsearch/dnd5e\?terms\=</a> You'll get everything in one go.
WOW! &nbsp;That works! &nbsp;thanks!