REST API: PATCH/events/{id}
Use this method to edit information of an existing event associated to an event id.
Request
{ plotId: 232 title: 'Bathroom renovated', //Title of event description: 'Changed the floors and got a new shower, X did a really good job', // Event description type: 1, // Event type, need to be defined, Events from PO or Events from matrikkel subType : 'type should be typed' // May be renovation, dateStart: '2019-04-25', // Event started this date dateEnd: '2019-04-30', // Event ended this date companyIds: [23,123], documentIds: [23,12], roomIds: [231,545], imageIds: [3,5], totalValue: 20000, } |
Success Response
HTTP Response: 200 (Ok)
{ success: true, response: { id: 4, link: "http://localhost:500/events/4", uploadLink: null } } |
Error Response
{ success: true, code: 'INVALID_REQUEST_BODY' //example } |
Request Validations
Scenario | HTTP Response | Error Code |
---|---|---|
No request payload found | 400 | REQUIRED_FIELDS_MISSING |
Invalid Model Status | 400 | INVALID_REQUEST_BODY |
General Exception | 500 | EXCEPTION_OCCURRED |
All fields are optional. A partial object of the above could be passed in the request. Passed properties in the request are validated against the following criteria.
Required Field | Validation Requirements | Error Code |
---|---|---|
id (request parameter) |
Should be a valid existing event id |
EVENT_INVALID_ID |
plotId |
Should be integer or long |
INVALID_REQUEST_BODY |
Should be a non-zero positive value |
PLOT_INVALID_ID | |
Should be a valid existing plot id | PLOT_NOT_FOUND | |
title |
Should not be empty |
EVENT_INVALID_TITLE |
Can not be longer than 500 characters | EVENT_TITLE_LENGTH_EXCEEDED | |
description | Can not be longer than 500 characters | EVENT_DESCRIPTION_LENGTH_EXCEEDED |
type |
Should be integer or long |
INVALID_REQUEST_BODY |
Should be a non-zero positive value | EVENT_INVALID_TYPE | |
Should be a valid existing event origin id | ||
Should be type 1 at all times. (for the Foxy MVP) | ||
subType |
Should not be empty |
EVENT_INVALID_SUBTYPE |
Cannot be longer than 50 characters but, no shorter than 3 characters. Should not only consist of whitespaces | EVENT_INVALID_SUBTYPE | |
dateStarted |
Should be in a valid datetime format |
INVALID_REQUEST_BODY |
totalValue |
Should be integer or long |
INVALID_REQUEST_BODY |
Should be non zero positive value | EVENT_INVALID_TOTALVALUE | |
roomIds |
Should be room id attached to the plot |
ROOM_INVALID_ID |
All values should be non zero positive values | ROOM_INVALID_ID | |
All values should be integer or long | INVALID_REQUEST_BODY | |
endDate |
Should be in a valid datetime format |
INVALID_REQUEST_BODY |
Should be at a later date than the specified start date | EVENT_INVALID_STARTDATE | |
imageIds | All values should be non zero positive values | EVENT_INVALID_IMAGE_ID |
There should exist 1 or more images already attached to the event | EVENT_IMAGES_NOT_FOUND | |
All image Ids should be valid Ids among the existing images | EVENT_INVALID_IMAGE_ID |
Comments
0 comments
Please sign in to leave a comment.