Requires the role: | manager |
POST | /bookings |
---|
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports Infrastructure.Api.Interfaces.ServiceOperations.Bookings
Imports Infrastructure.Api.Interfaces.ServiceOperations
Imports Application.Interfaces.Resources
Namespace Global
Namespace Application.Interfaces.Resources
Public Partial Class Booking
Implements IIdentifiableResource
Public Overridable Property StartUtc As Date
Public Overridable Property EndUtc As Date
Public Overridable Property BorrowerId As String
Public Overridable Property CarId As String
Public Overridable Property Id As String
End Class
End Namespace
Namespace Infrastructure.Api.Interfaces.ServiceOperations
Public Partial Class PostOperationTenanted(Of TResponse)
Inherits PostOperationUnTenanted(Of TResponse)
Implements ITenantedRequest
Public Overridable Property OrganisationId As String
End Class
Public Partial Class PostOperationUnTenanted(Of TResponse)
Implements IPost
End Class
End Namespace
Namespace Infrastructure.Api.Interfaces.ServiceOperations.Bookings
Public Partial Class CreateBookingRequest
Inherits PostOperationTenanted(Of CreateBookingResponse)
Public Overridable Property CarId As String
Public Overridable Property StartUtc As Date
Public Overridable Property EndUtc As Nullable(Of Date)
End Class
Public Partial Class CreateBookingResponse
Public Overridable Property ResponseStatus As ResponseStatus
Public Overridable Property Booking As Booking
End Class
End Namespace
End Namespace
VB.NET CreateBookingRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /bookings HTTP/1.1
Host: staging-api.billiecart.com.au
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
carId: String,
endUtc: ,
organisationId: String
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { responseStatus: { errorCode: String, message: String, stackTrace: String, errors: [ { errorCode: String, fieldName: String, message: String, meta: { String: String } } ], meta: { String: String } }, booking: { borrowerId: String, carId: String, id: String } }