diff --git a/.gitignore b/.gitignore index 894cfc1..a63783e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -*.bak* \ No newline at end of file +*.bak* +*.lck \ No newline at end of file diff --git a/Docs/REST-API/API Reference.md b/Docs/REST-API/API Reference.md new file mode 100644 index 0000000..bfca8d9 --- /dev/null +++ b/Docs/REST-API/API Reference.md @@ -0,0 +1,113 @@ +# API Reference + +The vpr Api ist created around REST. Our Api has several different endpoint, that are URL based and accept standard form-encoded request bodies. +It returns JSON-encoded responses and uses standard HTTP response codes. + +--- + +## The Endpoints at "/vpr/" +GET: +- /all-users + +POST: +- /all-events +- /add-user +- /add-event +- /del-event + +--- + +## Status-codes dan HTTP-responses + +| STATUS | meaning | +| --- | --- | +| 200 | OK. The Request was successful | +| 400 | Bad request. Check if you send all parameter | +| 404 | endpoint not found. The Url might contain a spelling mistake | +| 405 | Request-Method not allowed. Check if the endpoint requires an GET or POST request | +| 500 | Internal Server error. The request failed due to an exception at the server, the Request-parameter might be in a wrong format, or the database might be unreachable | + +--- + +## /all-users + +Request (GET): + + curl localhost:8080/vpr/all-users + +Response: + + [ + [ + userId: int, + forename: string, + name: string + ] + ] + +--- + +## /all-events + +Request (POST): + + curl localhost:8080/vpr/all-events -X POST -d "userId=" + +Response: + + [ + [ + eventId: int, + name: string, + start: string, + priority: int, + isFullDay: boolean, + date: string, + userId: int, + forename: string, + name: string + + ] + ] + +--- + +## /add-user + +Request (POST): + + curl localhost:8080/vpr/add-user -X POST -d "name=&forename=&password=&isAdmin=" + +Response: + + status 200 if request is ok + + And String "Saved" + +--- + +## /add-event + +Request (POST): + + curl localhost:8080/vpr/add-event -X POST -d "userId=&date=&name=&start=&end=&prority=&isFullDay=&isPrivate=" + +Response: + + status 200 if request is ok + + And String "Saved" + +--- + +## /del-event + +Request (POST): + + curl localhost:8080/vpr/del-event -X POST -d "eventId=" + +Response: + + status 200 if request is ok + + And String "Deleted" \ No newline at end of file