Skip to content
Philipp Piwo edited this page May 10, 2016 · 7 revisions

Create Posting

To be able to create a new Posting you have to have an User and access token In order to post your current location your User has to be Participant, as well as part of a Team

Parameters text, postLocation and uploadMediaTypes are optional, but you have to have one of them. date, which is the local unixtimestamp of the client, is mandantory.

uploadMediaTypes has to be an array of the mediatypes you want include in your Posting, acceptable values are: image, video and audio, multiple values are possible.

Hashtags present in text are automatically parsed and saved to hashtags field.

POST /posting/ HTTP/1.1
Authorization: Bearer YOURAUTHENTICATIONTOKEN
Content-Type: application/json
Host: yourdomain.org
Connection: close

{
  "text": "testposting #nice",
  "postingLocation": {"latitude":"0123", "longitude":"4567"},
  "uploadMediaTypes": ["image"],
  "date": 1461455777000
}

As a response you would then get the following Json

{
  "id": 1,
  "text": "testposting #nice",
  "date": 1457792889,
  "distance": 202.121,
  "postingLocation": {
    "latitude": 0123,
    "longitude": 4567
  },
  "media": [
    {
      "id": 1,
      "type": "IMAGE",
      "uploadToken": "eyJ0eXAiOigKV1QiLCJhdGciOiJIUzUxMiJ9.eyJzdWJqZWN0IjfiMiJ9.t1vOgpS5aTIW7Fg6g0d1eDWuejaQPnc7TBH2-phSCoWXLasdlo43e6p0I12CdVQtLFAWgtvJ_TQFeuD2iFI9ae9Pg",
      "sizes": []
    }
  ],
  "user": {
    "password": null,
    "firstname": null,
    "lastname": null,
    "email": "[email protected]",
    "gender": null,
    "id": 1,
    "participant": null,
    "profilePic": {
      "id": 1,
      "type": "IMAGE",
      "uploadToken": null,
      "sizes": []
    },
    "blocked": false
  },
  "comments": [],
  "likes": 0,
  "hashtags": ["nice"]
}

The uploadTokens in media for each object will authorize you to upload your files at the Uploader-Service.

See detailed instructions here: Media

Create Comment for Posting

For every Posting you can create unlimited Comments with an authenticated user

POST /posting/{id}/comment/ HTTP/1.1
Authorization: Bearer YOURAUTHENTICATIONTOKEN
Content-Type: application/json
Host: yourdomain.org
Connection: close

{
  "text": "testcomment",
  "date": 1461455777000
}

Create Like for Posting

For every Posting you can create a Like with an authenticated user

POST /posting/{id}/like/ HTTP/1.1
Authorization: Bearer YOURAUTHENTICATIONTOKEN
Content-Type: application/json
Host: yourdomain.org
Connection: close

{
  "date": 1461455777000
}

Get Likes for Posting

GET/posting/{id}/like/ HTTP/1.1
Host: yourdomain.org
Connection: close
[
  {
    "id": 1,
    "date": 1462886805000,
    "media": null,
    "user": {
      "firstname": null,
      "lastname": null,
      "id": 1,
      "participant": null,
      "profilePic": {
        "id": 1,
        "type": "IMAGE",
        "uploadToken": null,
        "sizes": []
      },
      "roles": [],
      "blocked": true
    }
  },
  {
    "id": 2,
    "date": 1462886807000,
    "media": null,
    "user": {
      "firstname": null,
      "lastname": null,
      "id": 2,
      "participant": null,
      "profilePic": {
        "id": 2,
        "type": "IMAGE",
        "uploadToken": null,
        "sizes": []
      },
      "roles": [],
      "blocked": true
    }
  }
]

Get Postings By Hashtag

Postings can be found by given hashtag

GET/posting/hashtag/{hashtag}/ HTTP/1.1
Host: yourdomain.org
Connection: close

Json-response will be an array of posting objects which contain given hashtag, as seen above

Clone this wiki locally