Skip to content
This repository has been archived by the owner on Sep 27, 2018. It is now read-only.
Budi Syahiddin edited this page Dec 24, 2017 · 1 revision

Retrieving of Post

URL: localhost:8080/api/v1/post

Method: GET

Optional params:

  • postId=[String]
  • locationId=[Int]
  • userId=[String]
  • limit=[Int] (Default 20)

Success Response:

[
    {
        "postId": "4a6a5d0a5ae92ee1ac620a664f3834820cc8043e348e5af2cdf4ac3aec265138",
        "location": {
            "locationId": 0,
            "locationName": "NUS",
            "locationDetails": "NATIONAL UNIVERSITY OF SINGAPORE"
        },
        "expiryTime": "Dec 26, 2017 2:30:00 PM",
        "description": "NASI BRIYANI PORK DAY 2",
        "foodAvailability": "ABUNDANT",
        "createdAt": "Dec 19, 2017 12:32:36 AM",
        "updatedAt": "Dec 19, 2017 12:32:36 AM",
        "posterId": "DA448BF1D6C2C58D1CF08EDB39B4FA28B71DDD8EC4D5F659287A8DB1FF95594D"
    },
    {
        "postId": "dd6d54e1fc67a1840deb7d4860b5546a5b4861eb1d914d149fbf35c11201d269",
        "location": {
            "locationId": 5,
            "locationName": "NP",
            "locationDetails": "NGEE ANN POLYTECHNIC"
        },
        "expiryTime": "Jan 1, 2018 2:30:00 PM",
        "dietary": "HALAL",
        "description": "NEW YEAR PARTY @ VOID DECK",
        "foodAvailability": "ABUNDANT",
        "createdAt": "Dec 23, 2017 1:05:57 AM",
        "updatedAt": "Dec 23, 2017 1:05:57 AM",
        "posterId": "DA448BF1D6C2C58D1CF08EDB39B4FA28B71DDD8EC4D5F659287A8DB1FF95594D"
    },
    {
        "postId": "ac76fe6a546e61fec0862d80a1a827245244073557ee2e3ec548c93fbbad39fc",
        "location": {
            "locationId": 7,
            "locationName": "TP",
            "locationDetails": "TEMASEK POLYTECHNIC"
        },
        "expiryTime": "Jan 1, 2018 10:00:00 PM",
        "description": "ANIME FEST",
        "foodAvailability": "ABUNDANT",
        "createdAt": "Dec 23, 2017 1:14:26 AM",
        "updatedAt": "Dec 23, 2017 1:14:26 AM",
        "posterId": "DA448BF1D6C2C58D1CF08EDB39B4FA28B71DDD8EC4D5F659287A8DB1FF95594D"
    }
]

Error Response: Nothing

  • Code: 200

Making a Post

URL: localhost:8080/api/v1/post

Method: POST

Headers:

  • Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBdXRoZW50aWNhdGlvbiIsImlzcyI6Ik1zb2NpZXR5IiwiaWQiOiJEQTQ0OEJGMUQ2QzJDNThEMUNGMDhFREIzOUI0RkEyOEI3MURERDhFQzRENUY2NTkyODdBOERCMUZGOTU1OTREIiwiZW1haWwiOiJnaG9zdG9wczFAaG90bWFpbC5zZyJ9.3YA0oduJc18SDY9SKmUn-GsRcXnKM9rWfGk8n8u9amc Note: After Bearer there has to be a space before the token

Required data Params:

  • locationId=[Int]
  • expiryTime=[String] Note: Format is dd-MM-yyyy hh:mm:ss (Phone's Time)
  • images=[*.jpg || *.jpeg || *.png] Note: No limit on number of pictures but there is a total size limit of 9mb
  • dietary=[enum("HALAL","VEGETARIAN","")]
  • description=[String] Note: Max 200char
  • foodAvailability=[enum("ABUNDANT","FINISHING","FINISHED")]

Success Response: Posted Success

Error Response:

  • Code : 400 Bad Request
{
    "msg": "Bad Request",
    "errorId": 5640
}

or

{
    "msg": "Bad Request",
    "errorId": 654
}

Updating a Post

URL: localhost:8080/api/v1/post

Method: PUT

Headers:

  • Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBdXRoZW50aWNhdGlvbiIsImlzcyI6Ik1zb2NpZXR5IiwiaWQiOiJEQTQ0OEJGMUQ2QzJDNThEMUNGMDhFREIzOUI0RkEyOEI3MURERDhFQzRENUY2NTkyODdBOERCMUZGOTU1OTREIiwiZW1haWwiOiJnaG9zdG9wczFAaG90bWFpbC5zZyJ9.3YA0oduJc18SDY9SKmUn-GsRcXnKM9rWfGk8n8u9amc Note: After Bearer there has to be a space before the token

Required data Params:

  • locationId=[Int]
  • expiryTime=[String] Note: Format is dd-MM-yyyy hh:mm:ss (Phone's Time)
  • images=[*.jpg || *.jpeg || *.png] Note: No limit on number of pictures but there is a total size limit of 9mb
  • dietary=[enum("HALAL","VEGETARIAN","")]
  • description=[String] Note: Max 200char
  • foodAvailability=[enum("ABUNDANT","FINISHING","FINISHED")]
  • postId=[String]

Success Response: Post Update success

Error Response: Same as POST


Deleting a Post

URL: localhost:8080/api/v1/post

Method: DELETE

Headers:

  • Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBdXRoZW50aWNhdGlvbiIsImlzcyI6Ik1zb2NpZXR5IiwiaWQiOiJEQTQ0OEJGMUQ2QzJDNThEMUNGMDhFREIzOUI0RkEyOEI3MURERDhFQzRENUY2NTkyODdBOERCMUZGOTU1OTREIiwiZW1haWwiOiJnaG9zdG9wczFAaG90bWFpbC5zZyJ9.3YA0oduJc18SDY9SKmUn-GsRcXnKM9rWfGk8n8u9amc Note: After Bearer there has to be a space before the token

Required data Params:

  • postId=[String]

Success Response: Delete Success

Error Response:

  • Code : 400 Bad Request
{
    "msg": "Bad Request",
    "errorId": 8974
}
Clone this wiki locally