Requires the role: | manager |
POST | /cars |
---|
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports Infrastructure.Api.Interfaces.ServiceOperations.Cars
Imports Infrastructure.Api.Interfaces.ServiceOperations
Imports Application.Interfaces.Resources
Namespace Global
Namespace Application.Interfaces.Resources
Public Partial Class Car
Implements IIdentifiableResource
Public Sub New()
Managers = New List(Of CarManager)
End Sub
Public Overridable Property Manufacturer As CarManufacturer
Public Overridable Property Plate As CarLicensePlate
Public Overridable Property Owner As CarOwner
Public Overridable Property Managers As List(Of CarManager)
Public Overridable Property Status As String
Public Overridable Property Altered As Nullable(Of Boolean)
Public Overridable Property Id As String
End Class
Public Partial Class CarLicensePlate
Public Overridable Property Jurisdiction As String
Public Overridable Property Number As String
End Class
Public Partial Class CarManager
Public Overridable Property Id As String
End Class
Public Partial Class CarManufacturer
Public Overridable Property Year As Integer
Public Overridable Property Make As String
Public Overridable Property Model As String
End Class
Public Partial Class CarOwner
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.Cars
Public Partial Class CreateCarRequest
Inherits PostOperationTenanted(Of CreateCarResponse)
Public Overridable Property Year As Integer
Public Overridable Property Make As String
Public Overridable Property Model As String
End Class
Public Partial Class CreateCarResponse
Public Overridable Property ResponseStatus As ResponseStatus
Public Overridable Property Car As Car
End Class
End Namespace
End Namespace
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 /cars HTTP/1.1
Host: staging-api.billiecart.com.au
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
year: 0,
make: String,
model: String,
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 } }, car: { manufacturer: { year: 0, make: String, model: String }, plate: { jurisdiction: String, number: String }, owner: { id: String }, managers: [ { id: String } ], status: String, altered: False, id: String } }