Comments (10)
With help of Nasicus I have connected to the appropriate APIs
from d2-holy-grail.
For the sake of completeness / for future reference:
GET
tohttps://d2-holy-grail.herokuapp.com/api/grail/<username>
gives a JSON with the status of all itemsPUT
tohttps://d2-holy-grail.herokuapp.com/api/grail/<username>
with the JSON retrieved from the GET (after making modifications to the status of the relevant items, and with apassword
field [in plain text] added to the root object), will update the status of all items
The format of the JSON will be something like (simplified, the actual JSON has way more elements obviously):
{
"address":"squeek502",
"data":{
"uniques":{
"armor":{
"chest":{
"normal":{
"Greyform":{
"wasFound":true,
"note":"Locations:\n_LOD_SharedStashSave.sss page 154"
},
}
}
}
}
}
},
"sets":{
"Angelic Raiment":{
"Angelic Wings":{
"wasFound":5,
"note":"Locations:\n_LOD_SharedStashSave.sss page 213\n_LOD_SharedStashSave.sss page 213\n_LOD_SharedStashSave.sss page 213\n_LOD_SharedStashSave.sss page 213\n_LOD_SharedStashSave.sss page 213"
},
}
}
}
},
"runewordData":{
"Ancient's Pledge":{
"wasFound":3,
"note":"Locations:\n_LOD_SharedStashSave.sss page 23\n_LOD_SharedStashSave.sss page 23\n_LOD_SharedStashSave.sss page 23"
},
},
"settings":{
"useItemCountMode":true
},
"token":"2020-08-17T21:32:28.478Z",
"version":"1.1.0"
}
from d2-holy-grail.
Thanks for that! What is this "Locations" part you have included in your example? Is that for something you are using the API for? Because I don't see any use for it on the UI
from d2-holy-grail.
That's something I'm using the API for via https://github.com/squeek502/d2grailcheck (still unfinished). It uses the "note" field for each item to note which file/page an item is on. It's visible when you click on an item in the d2-holy-grail UI (example).
Other item fields that can be used but don't show up in the GET
if they aren't set:
isPerfect
: The 'is perfect' checkbox visible when you click on an item. Puts a star next to the item in the d2-holy-grail UI when set.
from d2-holy-grail.
how do you handle the fact that GET returns no data if the profile is new? The structure of the GET command is only properly created after at least one item has been checked through the web UI
from d2-holy-grail.
Currently, I actually embed the JSON instead of retrieving it from GET
, since my tool will overwrite the status of every item anyway. But that's potentially brittle if the format of the JSON changes, and I am planning on using a GET
request instead. Not sure what the best solution for an empty GET
would be, though. Might be worth adding something to the API for that case (maybe a query parameter to the GET
endpoint that forces returning empty keys?).
from d2-holy-grail.
If I remember correctly in the API I do not even know about the structure / schema of the JSON (you could send whatever JSON yo uwant to the server). So it's not really possible to add an API for that, there would be need for more changes.
Honestly when I started doing this I never expected that anybody apart from me is even going to use the site and now some people (like you) even use my API ;D
So sorry for having such a "bad" API ;)
btw:
As you can see here:
https://d2-holy-grail.herokuapp.com/stats
the site is still regulary used Grail Updates today
basically means that a total of 166 different users did a "save" call somewhen in the last 24 hours.
from d2-holy-grail.
Haha its just great that so many people have begun using the page, it's really great to see such a thriving grail community 👍
However, wouldn't you be able to impose the basic structure on the APIs without ruining backwards compatibility? It doesn't sound like a huge reformatting would be required.
Just as example I tried embedding the JSON in my own code to create a profile from scratch. However, I noticed that the ordering of the elements on the website is actually not retained if you do this.
See example: http://d2-holy-grail.herokuapp.com/testaddress2/holy/unique-armor
Here, the order is completely different, since by default the json keys are alphabetically sorted when calling GET from Python
from d2-holy-grail.
Does your JSON parser preserve order when decoding/encoding? That's something I had to make sure my JSON parser was doing for it to work right.
from d2-holy-grail.
@oskros not saying it would be hard to have the "scheme" on the server, but if you or anyone else really needs it, it still would need to be implemented first ;) keeping the exact same json structure should be easy though.
from d2-holy-grail.
Related Issues (20)
- The Scalper Francisca has the wrong graphics
- Heroku deleting free dynos HOT 3
- Ability to Reset Passwords HOT 1
- Can't see any items HOT 4
- Redirect from the main page to the logged account page if logged in HOT 5
- Possible update HOT 4
- Reset password HOT 3
- Possible to change login name or display name? HOT 2
- Add option to show Treasure class for each item HOT 1
- Unindentified names HOT 1
- [Feature]: Clear search HOT 3
- Hi i forgot my password HOT 2
- Stuck in read-only mode HOT 4
- Que-Hagan's Wisdom Infinite Search HOT 1
- Reset password? HOT 1
- Save actual stats of items
- Enhancement: Add support for re-importing json exports HOT 8
- Delete account, change/reset password HOT 4
- License File?
- assassin is spelled incorrectly assasin under $.grail.uniques.other.classes HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from d2-holy-grail.