Coder Social home page Coder Social logo

somtoday-api-docs's People

Contributors

770grappenmaker avatar bravechicken1 avatar elisaado avatar fish-o avatar jktechs avatar joosthoi1 avatar jxxit avatar malmeloo avatar mathijsbols avatar matttersteege avatar rijkvp avatar underlyingglitch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

somtoday-api-docs's Issues

403 error code after trying to get my grades

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': {}}

Get user id not working

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

{"error_description":"Invalid grant: Account has 2 attempts remaining","error":"invalid_grant"}

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

Additional info

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!

405 at logging in

Hey,

I try to login with the details you supply here, but i got a 405 method not allowed
could you help me out?
image
image

I think im doing something wrong, but i dont see what

SSO Authentication flow

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:

  • Either someone to provide me with a school, username and password of an account that can use SSO. (I understand that this is very sketchy) I will use them to analyse the requests made by the SOMToday app via a proxy, and will add the requests to this documentation.
  • Or someone to provide me with the requests made by the app when using SSO.

I have created a gitter room for further informal discussion:
https://gitter.im/somtoday-api-docs/community

Way for retrieving upcomping homework

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.

Adding homework retrieval to the documentation

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>"
    }
  ]
}

with the following input:
image

Invalid grant: Token revoked (HTTP error 403 ERR_BAD_REQUEST)

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.