Kodkollektivet / unitime-api

Unitime Rest API
http://api.kodkollektivet.se/unitime/
8 stars 2 forks source link

POST request to get events for multiple courses fails #10

Open ritzelpaket opened 6 years ago

ritzelpaket commented 6 years ago

curl -i -X POST -d '{"courses": ['4IK501']}' https://api.kodkollektivet.se/api/event/

fails with:

HTTP/1.1 404 Not Found
Server: nginx/1.10.2
Date: Mon, 06 Nov 2017 23:51:46 GMT
Content-Type: application/json
Content-Length: 37
Connection: keep-alive
Vary: Accept, Cookie
Allow: GET, POST, HEAD, OPTIONS
X-Frame-Options: SAMEORIGIN

{"message": "Invalid search format!"}
ritzelpaket commented 6 years ago

curl -i -X POST --header "Accept-Encoding: gzip, deflate" --header "Accept': */*" --header "User-Agent: python-requests/2.18.1" --header "Connection: keep-alive" --header "Content-Type: application/x-www-form-urlencoded" -d '{"courses": ['4IK501']}' https://api.kodkollektivet.se/api/event/

comes close to the request from the python examples.

ritzelpaket commented 6 years ago

Is this a big issue to fix? Can I help?

jhe10709 commented 6 years ago

I think this commit will resolve the issue: https://github.com/Kodkollektivet/unitime-api/commit/623462bd56812c3f1fb497af40bc4a1ab0f1a4c5

curl -i -X POST --header "Connection: keep-alive" --header "Content-Type: application/json" -d '{"courses": ["2DV513"]}' https://api.kodkollektivet.se/api/event/
jhe10709 commented 6 years ago

@ritzelpaket the new commit is in production and seems to resolve the issue