Closed 770grappenmaker closed 4 years ago
Hey, yes, this is possible.
Your idea seems great and actually not too hard to implement! There is a problem, we don't use SOMtoday for homework at our school, so I can't test the endpoint.
I have proefwerkweek these weeks, so I cannot find out what the exact endpoint is.
I get most of my info by decompiling and reverse engineering their app.
So..... Can I help with this? I also make some Android apps so I can probably also reverse engineer that stuff. Idk.
Oh and how did u get the application key for retrieving a user token?
I got the app ID and secret via the same method
You could try to load the APK file of the app into android studio and just search files for something like "huiswerk".
No, after a long search i cant find a homework fetcher: https://gyazo.com/0022269ac114b466b08e360f7199e4fe Maybe looking in the code of the activity?
ToekenningFetcher seems to be the one im looking for. It is an abstract class with 3 superclasses. Afspraak, dag and weekfetcher.
Suffix is "studiewijzeritemafspraaktoekenningen"
I think this is it, Ill try simulating requests using cURL, lemme check.
Yep, I found it just now! Let me know if it works, I'll go ahead and test it as well with a test homework-item a teacher put there for me.
I’ll let u know if it works. But for now my Linux machine won’t boot.
/rest/v1/studiewijzeritemafspraaktoekenningen?begintNaOfOp=2020-05-24
works for me with the following result
{
"items": [
{
"$type": "studiewijzer.RSWIAfspraakToekenning",
"links": [
{
"id": <REDACTED>,
"rel": "self",
"type": "studiewijzer.RSWIAfspraakToekenning",
"href": "https://bonhoeffer-api.somtoday.nl/rest/v1/studiewijzeritemafspraaktoekenningen/<REDACTED>"
}
],
"permissions": [
{
"full": "studiewijzer.RSWIAfspraakToekenning:READ:INSTANCE(<REDACTED>)",
"type": "studiewijzer.RSWIAfspraakToekenning",
"operations": [
"READ"
],
"instances": [
"INSTANCE(<REDACTED>)"
]
}
],
"additionalObjects": {},
"studiewijzer": {
"links": [
{
"id": <REDACTED>,
"rel": "koppeling",
"type": "studiewijzer.RAbstractStudiewijzer"
}
],
"permissions": [],
"additionalObjects": {},
"uuid": "<REDACTED>",
"naam": "<REDACTED>",
"vestiging": {
"links": [
{
"id": <REDACTED>,
"rel": "self",
"type": "instelling.RVestiging",
"href": "https://bonhoeffer-api.somtoday.nl/rest/v1/vestigingen/<REDACTED>"
}
],
"permissions": [
{
"full": "instelling.RVestiging:READ:INSTANCE(<REDACTED>)",
"type": "instelling.RVestiging",
"operations": [
"READ"
],
"instances": [
"INSTANCE(<REDACTED>)"
]
}
],
"additionalObjects": {},
"naam": "<REDACTED>"
}
},
"studiewijzerItem": {
"links": [
{
"id": <REDACTED>,
"rel": "self",
"type": "studiewijzer.RStudiewijzerItem",
"href": "https://bonhoeffer-api.somtoday.nl/rest/v1/studiewijzeritems/<REDACTED>"
}
],
"permissions": [
{
"full": "studiewijzer.RStudiewijzerItem:READ:INSTANCE(<REDACTED>)",
"type": "studiewijzer.RStudiewijzerItem",
"operations": [
"READ"
],
"instances": [
"INSTANCE(<REDACTED>)"
]
}
],
"additionalObjects": {},
"onderwerp": "Test",
"huiswerkType": "HUISWERK",
"omschrijving": "<p>opgave 1 2 3</p>",
"inleverperiodes": false,
"lesmateriaal": false,
"projectgroepen": false,
"bijlagen": [],
"externeMaterialen": [],
"inlevermomenten": [],
"tonen": true,
"notitieZichtbaarVoorLeerling": false
},
"sortering": 0,
"lesgroep": {
"links": [
{
"id": <REDACTED>,
"rel": "self",
"type": "lesgroep.RLesgroep",
"href": "https://bonhoeffer-api.somtoday.nl/rest/v1/lesgroepen/<REDACTED>"
}
],
"permissions": [
{
"full": "lesgroep.RLesgroep:READ:INSTANCE(<REDACTED>)",
"type": "lesgroep.RLesgroep",
"operations": [
"READ"
],
"instances": [
"INSTANCE(<REDACTED>)"
]
}
],
"additionalObjects": {},
"naam": "b5v.<REDACTED>",
"schooljaar": {
"$type": "onderwijsinrichting.RSchooljaar",
"links": [
{
"id": <REDACTED>,
"rel": "self",
"type": "onderwijsinrichting.RSchooljaar",
"href": "https://bonhoeffer-api.somtoday.nl/rest/v1/schooljaren/<REDACTED>"
}
],
"permissions": [
{
"full": "onderwijsinrichting.RSchooljaar:READ:INSTANCE(<REDACTED>)",
"type": "onderwijsinrichting.RSchooljaar",
"operations": [
"READ"
],
"instances": [
"INSTANCE(<REDACTED>)"
]
}
],
"additionalObjects": {},
"naam": "2019/2020",
"vanafDatum": "2019-08-01",
"totDatum": "2020-07-31",
"isHuidig": true
},
"vak": {
"links": [
{
"id": <REDACTED>,
"rel": "self",
"type": "onderwijsinrichting.RVak",
"href": "https://bonhoeffer-api.somtoday.nl/rest/v1/vakken/<REDACTED>"
}
],
"permissions": [
{
"full": "onderwijsinrichting.RVak:READ:INSTANCE(<REDACTED>)",
"type": "onderwijsinrichting.RVak",
"operations": [
"READ"
],
"instances": [
"INSTANCE(<REDACTED>)"
]
}
],
"additionalObjects": {},
"afkorting": "<REDACTED>",
"naam": "<REDACTED>"
},
"heeftStamgroep": false,
"examendossierOndersteund": true
},
"datumTijd": "<REDACTED>",
"aangemaaktOpDatumTijd": "<REDACTED>"
}
]
}
That is acctually funny it says “notitie zichtbaar voor leerling” = false. But if you use this (even as a student) you can read it
But yeah for now thanks for helping me. Tomorrow I’ll start coding the bot and if it’s done I’ll send you the results if you would like to.
Sure :) I'd love to see that!
Good luck with your linux machine
You know what I’ll make it open source so even my friends can use it. And the rest of the world of course
This can be closed right? Or do you still want to have it opened because you need to update the docs? (And maybe ur lib)
Also do you know a good Dex compiler? I got one but it produced tons of errors, some files only parts of it were readable.
You mean a decompiler? I use dex2jar myself, and then open the jar with jd-gui.
Yes, the issue can be closed and I'll create a new one for adding homework to the documentation.
@770grappenmaker if you eventually get it working, could you send me a sample of your JSOn output from the API endpoint like I did? This'll help me verify whether or not I've got the correct endpoint and documentation about it.
Of course. I’ll store all raw request data in a database and then I can send as many json as you want xD
Hahaha alright
Can you help me with something? I tried this endpoint, but it completely ignores my begintNaOfOp parameter. My code: https://github.com/770grappenmaker/somtoday-bot/blob/master/events/fetchHomework.js
I think it's better to discuss this on something like discord, what's your tag?
Removed
Hello, My question is: Is there a way using the SomToday REST API to fetch upcoming homework?
I need this because I am tired of teachers changing homework just 2 days before. So what I want to do is fetch my homework, store it in a database, and if it is different from the homework before, filter out the changes and post a message on Discord with the changes. This will loop infinitely with a period of 30 minutes.
Thanks in advance.
PS. I would like to know how you got all this information about SomToday.