Expense - Post mileages
API Url
Used for creating single mileage data.
http://localhost:16010/ProMarkREST/rest/Mileage/employees/{emp_id}/mileages
Permissions: user
Path parameters
| Field | Type | Description |
|---|---|---|
| emp_id | String | Employee ID. |
Parameter
| Field | Type | Description |
|---|---|---|
| request | Object | Main object containing the request data. |
| data | Object | Object containg data to be uploaded. |
| mileages | Object[] | Collection of mileages to be created |
| accountId | String | Mileage account id. |
activityDescoptional | String | Activity description. |
activityIdoptional | String | Activity Id. |
| attendanceDate | Date | Date of mileage expense. |
| carRegNo | String | License plate of the car. |
| carType | Number | 0: Company car, 1: Private car |
commentoptional | String | A comment for the mileage |
departmentDescoptional | String | Department description. |
departmentIdoptional | String | Department Id. |
descriptionoptional | String | Description. |
| distance | Number | Distance of a route |
| from | String | Starting position of a route. |
projectDescoptional | String | Project description. |
projectIdoptional | String | Project Id. |
questionsoptional | Object[] | Collection of questions. |
| id | String | Unique identifier for the question. |
| label | String | Label to display on the question. Not to be changed on the client! |
| roundtrip | Boolean | If the mileage includes the return trip too. |
supplementsoptional | Object[] | A colection of supplements |
| id | String | Supplement unique id |
| type | Number | Supplement type. |
| to | String | Ending position of a route. |
viaoptional | String | Alternate route. |
| answer | String | The answer to the question. |
Request example:
{"request": {"data": {"mileages": [{"carRegNo": "B-04-AIU","carType": 1,"accountId": "001","roundtrip": true,"comment": "I had a flat tire on the way","from": "Bucharest","to": "Copenhagen","distance" : 2137,"attendanceDate": "2018-09-20","supplements": [{"id": "Supplement1","type": 1}],"questions": [{"id": "2","order": 1,"label": "Number of persons","answer": "6"},{"id": "1","order": 2,"label": "Client name","answer": "Magnus"}]}]}}}
Success 200
| Field | Type | Description |
|---|---|---|
| response | Object | Main object containing the response data. |
| data | Object | Object containing the requested data. |
| mileages | Object[] | Collection of mileages to be created |
| accountId | String | Mileage account id. |
activityDescoptional | String | Activity description. |
activityIdoptional | String | Activity Id. |
| attendanceDate | Date | Date of mileage expense. |
| carRegNo | String | License plate of the car. |
| carType | Number | 0: Company car, 1: Private car |
commentoptional | String | A comment for the mileage |
departmentDescoptional | String | Department description. |
departmentIdoptional | String | Department Id. |
descriptionoptional | String | Description. |
| distance | Number | Distance of a route |
| from | String | Starting position of a route. |
projectDescoptional | String | Project description. |
projectIdoptional | String | Project Id. |
questionsoptional | Object[] | Collection of questions. |
| answer | String | The answer to the question. |
answerDescriptionoptional | String | The answer description for those questions that are supplied also with a list of values. |
| dataType | Number | Data type of the question (0: Text, 1: Integer, 2: Decimal, 3: Boolean: 4: Date. 5: Time of day, 6: Date and time, 7: Time duration, 8: Time interval, 9: Date interval, 10: Date and time interval). Not to be changed on the client! 0-10 |
| id | String | Unique identifier for the question. |
| inputType | Number | Suggestion with controll type to display on the client (0: Standard input, depends on 'dataType', 1: Fill-in, 2: Drop-down, 3: Combo-box, 4: Text area, 5: Radio-set, 6: Check-box, 7: Selection list, 8: Calendar, 9: Calendar drop-down, 10: External lookup URI). Not to be changed on the client! 0-10 |
| isMandatory | Boolean | true = It is mandatory to enter an answer (select a value) on the question. Not to be changed on the client! |
| label | String | Label to display on the question. Not to be changed on the client! |
maxValueoptional | Number | Maximum value. Not to be changed on the client! |
minValueoptional | Number | Minimum value. Not to be changed on the client! |
| order | Number | The question order. |
valueoptional | Object[] | Collection of question values. |
| description | String | Description value. |
| id | String | Id of value. |
| roundtrip | Boolean | If the mileage includes the return trip too. |
supplementsoptional | Object[] | A colection of supplements |
| id | String | Supplement unique id |
| type | Number | Supplement type. |
| to | String | Ending position of a route. |
| transSeq | Number | Unique mileage transaction identifier. |
viaoptional | String | Alternate route. |
messageoptional | Object | Object containing response messages. |
| code | Number | Message code. |
| text | String | Message text. |
| type | String | Type of message. "warning""info" |
Success example:
HTTP/1.1 200 OK{"response": {"data": {"mileages": [{"transSeq": 2193120"carRegNo": "B-04-AIU","carType": 1,"accountId": "001","roundtrip": true,"comment": "I had a flat tire on the way","from": "Bucharest","to": "Copenhagen","distance" : 2137 ,"attendanceDate": "2018-09-20""supplements": [{"id": "Supplement1","type": 1}],"questions": [{"id": "2","order": 1,"label": "Number of persons","isMandatory": false,"inputType": 0,"dataType": 1,"answer": "6"},{"id": "1","order": 2,"label": "Client name","isMandatory": true,"inputType": 0,"dataType": 0,"answer": "Magnus"}]}]},"errorCode": 0,"errorMessage": ""}}
Error 4xx
| Field | Type | Description |
|---|---|---|
| response | Object | Main object containing the response data. |
| data | Object | Object containing the requested data (empty). |
| errorCode | Number | Error code. |
| errorMessage | String | Error description. |
Error example:
{"response": {"errorCode": 5,"errorMessage": "No employees"}}