- Login/Logout
  - post Login
  - post Logout
- Post
  - get List posts
  - post New post
  - patch Update post
  - del Delete post
- Register
  - post Register
  - patch Confirm register
- User
  - get List users
  - get Get user
  - patch Update user
  - del Delete user

API docs by Redocly

# PHP Course Exam (1.0.0)

Download OpenAPI specification:Download

Kilian Kurt Hofmann: khofmann@zedat.fu-berlin.de

PHP Course (ABV FU Berlin) 2024 Exam

https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/docs/

## Login/Logout

## Login

Log in user.

##### Request Body schema: application/json
required

username required | string
password required | string

### Responses

https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/login

### Request samples

- Payload

Content type
application/json
`
{

- "username": "string",
- "password": "string"

}`

### Response samples

- 200
- 400
- 401
- 404
- 500

Content type
application/json
`
{

- "user":
  {
  - "id": 0,
  - "username": "string",
  - "status": 0,
  - "email": "string",
  - "image": "string",
  - "isAdmin": true,
  - "memberSince":
    {
    - "date": "2019-08-24T14:15:22Z",
    - "timezone_type": 0,
    - "timezone": "string"
    },
  - "postCount": 0
  },
- "token": "string"

}`

## Logout

Log out user.

##### Authorizations:

BasicAuth

### Responses

https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/logout

### Response samples

- 200

Content type
application/json
`true`

## Post

## List posts

List all posts, return full user data if authenticated.

##### Authorizations:

None BasicAuth

##### query Parameters

p | integer >= 0 Default: 0 Current page.
l | integer [ 0 .. 30 ] Default: 10 The number of items to return.

### Responses

https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/posts

### Response samples

- 200

Content type
application/json
Example
Not authenticated
`
{

- "pages": 0,
- "data":
  [
  - {
    - "id": 0,
    - "user":
      {
      - "username": "string",
      - "image": "string"
      },
    - "content": "string",
    - "postedAt":
      {
      - "date": "2019-08-24T14:15:22Z",
      - "timezone_type": 0,
      - "timezone": "string"
      }
    }
  ]

}`

## New post

Create a new post.

##### Authorizations:

BasicAuth

##### Request Body schema: application/json
required

content required | string

### Responses

https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/posts

### Request samples

- Payload

Content type
application/json
`
{

- "content": "string"

}`

### Response samples

- 200
- 400

Content type
application/json
`
{

- "id": 0,
- "user":
  {
  - "id": 0,
  - "username": "string",
  - "status": 0,
  - "email": "string",
  - "image": "string",
  - "isAdmin": true,
  - "memberSince":
    {
    - "date": "2019-08-24T14:15:22Z",
    - "timezone_type": 0,
    - "timezone": "string"
    },
  - "postCount": 0
  },
- "content": "string",
- "postedAt":
  {
  - "date": "2019-08-24T14:15:22Z",
  - "timezone_type": 0,
  - "timezone": "string"
  }

}`

## Update post

Update post with ID.
Requires logged in user to have admin permissions for posts not made by them.

##### Authorizations:

BasicAuth BasicAuth

##### path Parameters

id required | integer <int14> Post ID

##### Request Body schema: application/json

content | string

### Responses

https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/posts/{id}

### Request samples

- Payload

Content type
application/json
`
{

- "content": "string"

}`

### Response samples

- 200
- 401
- 404
- 500

Content type
application/json
`
{

- "id": 0,
- "user":
  {
  - "id": 0,
  - "username": "string",
  - "status": 0,
  - "email": "string",
  - "image": "string",
  - "isAdmin": true,
  - "memberSince":
    {
    - "date": "2019-08-24T14:15:22Z",
    - "timezone_type": 0,
    - "timezone": "string"
    },
  - "postCount": 0
  },
- "content": "string",
- "postedAt":
  {
  - "date": "2019-08-24T14:15:22Z",
  - "timezone_type": 0,
  - "timezone": "string"
  }

}`

## Delete post

Delete post with ID.

##### Authorizations:

BasicAuth

##### path Parameters

id required | integer <int14> Post ID

### Responses

https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/posts/{id}

### Response samples

- 200
- 404

Content type
application/json
`
{

- "id": 0,
- "user":
  {
  - "id": 0,
  - "username": "string",
  - "status": 0,
  - "email": "string",
  - "image": "string",
  - "isAdmin": true,
  - "memberSince":
    {
    - "date": "2019-08-24T14:15:22Z",
    - "timezone_type": 0,
    - "timezone": "string"
    },
  - "postCount": 0
  },
- "content": "string",
- "postedAt":
  {
  - "date": "2019-08-24T14:15:22Z",
  - "timezone_type": 0,
  - "timezone": "string"
  }

}`

## Register

Register a new user.

##### Request Body schema: application/json
required

username required | string
email required | string
password required | string

### Responses

https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/register

### Request samples

- Payload

Content type
application/json
`
{

- "username": "string",
- "email": "string",
- "password": "string"

}`

### Response samples

- 200
- 400
- 404

Content type
application/json
`
{

- "id": 0,
- "username": "string",
- "status": 0,
- "email": "string",
- "image": "string",
- "isAdmin": true,
- "memberSince":
  {
  - "date": "2019-08-24T14:15:22Z",
  - "timezone_type": 0,
  - "timezone": "string"
  },
- "postCount": 0

}`

## Confirm register

Confirm a registration.

##### Request Body schema: application/json
required

code required | string <uuid4>

### Responses

https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/register

### Request samples

- Payload

Content type
application/json
`
{

- "code": "string"

}`

### Response samples

- 200
- 400
- 404

Content type
application/json
`
{

- "id": 0,
- "username": "string",
- "status": 0,
- "email": "string",
- "image": "string",
- "isAdmin": true,
- "memberSince":
  {
  - "date": "2019-08-24T14:15:22Z",
  - "timezone_type": 0,
  - "timezone": "string"
  },
- "postCount": 0

}`

## User

## List users

List all users.

##### Authorizations:

BasicAuth

##### query Parameters

p | integer >= 0 Default: 0 Current page.
l | integer [ 0 .. 30 ] Default: 10 The number of items to return.

### Responses

https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/users

### Response samples

- 200

Content type
application/json
`
{

- "pages": 0,
- "data":
  [
  - {
    - "id": 0,
    - "username": "string",
    - "status": 0,
    - "email": "string",
    - "image": "string",
    - "isAdmin": true,
    - "memberSince":
      {
      - "date": "2019-08-24T14:15:22Z",
      - "timezone_type": 0,
      - "timezone": "string"
      },
    - "postCount": 0
    }
  ]

}`

## Get user

Get user by ID.

##### Authorizations:

BasicAuth

##### path Parameters

id required | integer <int14> User ID

### Responses

https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/users/{id}

### Response samples

- 200
- 404

Content type
application/json
`
{

- "id": 0,
- "username": "string",
- "status": 0,
- "email": "string",
- "image": "string",
- "isAdmin": true,
- "memberSince":
  {
  - "date": "2019-08-24T14:15:22Z",
  - "timezone_type": 0,
  - "timezone": "string"
  },
- "postCount": 0

}`

## Update user

Update user with ID.
Use special ID `self` to update logged in user.
Requires logged in user to have admin permissions for any ID other than `self`.

##### Authorizations:

BasicAuth BasicAuth

##### path Parameters

id required | integer <int14> User ID

##### Request Body schema: application/json

username | string
password | string
email | string

### Responses

https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/users/{id}

### Request samples

- Payload

Content type
application/json
`
{

- "username": "string",
- "password": "string",
- "email": "string"

}`

### Response samples

- 200
- 404
- 500

Content type
application/json
`
{

- "id": 0,
- "username": "string",
- "status": 0,
- "email": "string",
- "image": "string",
- "isAdmin": true,
- "memberSince":
  {
  - "date": "2019-08-24T14:15:22Z",
  - "timezone_type": 0,
  - "timezone": "string"
  },
- "postCount": 0

}`

## Delete user

Delete user with ID.

##### Authorizations:

BasicAuth

##### path Parameters

id required | integer <int14> User ID

### Responses

https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/users/{id}

### Response samples

- 200
- 404

Content type
application/json
`
{

- "id": 0,
- "username": "string",
- "status": 0,
- "email": "string",
- "image": "string",
- "isAdmin": true,
- "memberSince":
  {
  - "date": "2019-08-24T14:15:22Z",
  - "timezone_type": 0,
  - "timezone": "string"
  },
- "postCount": 0

}`