elisaado / somtoday-api-docs Goto Github PK
View Code? Open in Web Editor NEWDocumentation for the SOMtoday API
Documentation for the SOMtoday API
How to get all the grades, not only the average but all the grades with the weighting (weging)
testUrl = base+'/rest/v1/resultaten/huidigVoorLeerling/'+str(userId)
grades = rq.get(testUrl, headers={'Authorization': 'Bearer '+access_token, 'Accept': 'application/json','Range':'items=5-7'}) print(grades.json());
this is some python code i am using to test.
i know my base url and token are correct.
the userId is from a request to /rest/v1/leerlingen
the json error is {'code': 403, 'reason': 'Forbidden', 'exception': 'javax.ws.rs.WebApplicationException', 'message': 'HTTP 403 Forbidden', 'applicationErrorParameters': {}}
const response = await fetch('https://somtoday.nl/oauth2/token', {method: 'post', body: params, headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
});
const school = await response.json();
console.log(school);
console.log(school.somtoday_api_url) // https://api.somtoday.nl
console.log(school.access_token) // <ACCES-TOKEN>
const params1 = new URLSearchParams();
params1.append("Content-Type", "application/x-www-form-urlencoded")
params1.append("Authorization", school.access_token)
const leerlingen = await fetch(school.somtoday_api_url + '/rest/v1/leerlingen', { method: 'get', headers: params1 });
const leerling1 = await leerlingen
console.log(leerling1) // unauthorized
i want my grades in this api. How to fix that
Hi, I'm trying to login to somtoday via curl in the terminal. I'm using the following command:
curl "https://production.somtoday.nl/oauth2/token" -d "grant_type=password&username=[school_uuid]\\[username]&password=[password]&scope=openid" -H "Authorization: Basic RDUwRTBDMDYtMzJEMS00QjQxLUExMzctQTlBODUwQzg5MkMyOnZEZFdkS3dQTmFQQ3loQ0RoYUNuTmV5ZHlMeFNHTkpY"
With [xyz]
being filled in (in plain text, no encryption) on my side.
However I keep getting the following error:
{"error_description":"Invalid grant: Account has 2 attempts remaining","error":"invalid_grant"}
It keeps saying that I have either 2 or 1 attempts remaining. It doesn't drop below 1.
How can I make this work?
Thanks,
Michiel
https://github.com/elisaado/somtoday-api-docs#grades-get-restv1resultatenhuidigvoorleerlingid
For getting the results of a user
i got a example response :)
{ "items": [{ "$type": "resultaten.RResultaat", "links": [{ "id": 1000000000, "rel": "self", "type": "resultaten.RResultaat", "href": "https://amstelveen-api.somtoday.nl/rest/v1/resultaten/1000000000" }], "permissions": [{ "full": "resultaten.RResultaat:READ:INSTANCE(1000000000)", "type": "resultaten.RResultaat", "operations": ["READ"], "instances": ["INSTANCE(1000000000)"] }], "additionalObjects": {}, "herkansingstype": "Geen", "resultaat": "10.0", "geldendResultaat": "10.0", "datumInvoer": "2018-10-31T17:32:15.218+0100", "teltNietmee": false, "toetsNietGemaakt": false, "leerjaar": 4, "periode": 1, "weging": 3, "isExamendossierResultaat": true, "isVoortgangsdossierResultaat": true, "type": "DeeltoetsKolom", "omschrijving": "Climaxloop", "vak": { "links": [{ "id": 200000000, "rel": "self", "type": "onderwijsinrichting.RVak", "href": "https://amstelveen-api.somtoday.nl/rest/v1/vakken/200000000" }], "permissions": [{ "full": "onderwijsinrichting.RVak:READ:INSTANCE(200000000)", "type": "onderwijsinrichting.RVak", "operations": ["READ"], "instances": ["INSTANCE(200000000)"] }], "additionalObjects": {}, "afkorting": "lo", "naam": "lichamelijke opvoeding" }, "leerling": { "links": [{ "id": 700000000, "rel": "self", "type": "leerling.RLeerlingPrimer", "href": "https://amstelveen-api.somtoday.nl/rest/v1/leerlingen/700000000" }], "permissions": [{ "full": "leerling.RLeerlingPrimer:READ:INSTANCE(700000000)", "type": "leerling.RLeerlingPrimer", "operations": ["READ"], "instances": ["INSTANCE(700000000)"] }], "additionalObjects": {}, "leerlingnummer": 100000, "roepnaam": "MyName", "achternaam": "StillMyName" }, "volgnummer": 123 }] }
Also: the [user id] is from a get reqest in /rest/v1/leerlingen, thats not clear at all where to get the id from
would be great to read that as a note as well
ps. tnx for the documentation it helped me out quiet a lot!
SOMToday has introduced a new way of authentication, and there are already several organisations that have enabled it and disabled username/password authentication. I found this out when #6 was opened.
I am afraid that it is not possible to retrieve tokens this way but I hope that there is still hope for us.
What I need:
I have created a gitter room for further informal discussion:
https://gitter.im/somtoday-api-docs/community
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.
Request URL /rest/v1/studiewijzeritemafspraaktoekenningen?begintNaOfOp=<homework list begin date>
seems to work and produces the following output
{
"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>"
}
]
}
How did you aquire a SOMToday API Key?
I managed to get my access_token and refresh_token using the steps needed for SSO authentication.
The access_token is valid for 1 hour, during which I can make requests without any issues.
However after that period things start to become a problem. Sometimes requesting a new access_token using the refresh_token works without any issues. However more often I get the error as described in the title.
I believe to have read somewhere that the refresh_tokens are valid for 30 days. However I can't find this anywhere anymore. Now it seems unlikely that the token has expired since I'm using it within 2-3 hours from the original request.
One other option could be that I'm accidentally using the refresh_token twice. Sometimes you seem to be able to use them twice, other times they're single use only?
Sinds vanavond werkt het opvragen van de token niet meer met grant_type=password
. De error die ik krijg is Invalid grant: Password grant is disabled for insecure clients.
Heeft er iemand al een alternatieve manier voor de authenticatie?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.