Required role: | Admin | Required permissions: | CanAccess, CanAdd |
POST | /sync/products/batch |
---|
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports PwC.Metering.Core.Services.Contracts.Requests
Imports PwC.Metering.Core.Domain.Concretes.Models
Namespace Global
Namespace PwC.Metering.Core.Domain.Concretes.Models
'''<Summary>
'''Represents a product.
'''</Summary>
<Api(Description:="Represents a product.")>
Public Partial Class Product
Implements IHasName
Public Sub New()
Tags = New List(Of String)
End Sub
'''<Summary>
'''The unique identifier of the product.
'''</Summary>
<ApiMember(Description:="The unique identifier of the product.", IsRequired:=true)>
Public Overridable Property Id As Integer
'''<Summary>
'''The position of this instance in a collection of 'Product' instances
'''</Summary>
<ApiMember(Description:="The position of this instance in a collection of 'Product' instances", IsRequired:=true)>
Public Overridable Property Index As Integer
'''<Summary>
'''The name of the product.
'''</Summary>
<ApiMember(Description:="The name of the product.", IsRequired:=true)>
<Validate(Validator:="NotEmpty")>
Public Overridable Property Name As String
'''<Summary>
'''The version of the product.
'''</Summary>
<ApiMember(Description:="The version of the product.", IsRequired:=true)>
<Validate(Validator:="NotEmpty")>
Public Overridable Property Version As String
'''<Summary>
'''The version of the product.
'''</Summary>
<ApiMember(Description:="The version of the product.")>
Public Overridable Property Description As String
'''<Summary>
'''Tags associated with the product.
'''</Summary>
<ApiMember(Description:="Tags associated with the product.")>
Public Overridable Property Tags As List(Of String)
End Class
End Namespace
Namespace PwC.Metering.Core.Services.Contracts.Requests
'''<Summary>
'''Represents a service request to register one or more products in a batch operation.
'''</Summary>
<Api(Description:="Represents a service request to register one or more products in a batch operation.")>
Public Partial Class BatchRegisterProducts
Inherits BatchRegisterProductsBase
Public Sub New()
Products = New List(Of Product)
End Sub
'''<Summary>
'''The products to register.
'''</Summary>
<ApiMember(Description:="The products to register.", IsRequired:=true)>
Public Overridable Property Products As List(Of Product)
End Class
'''<Summary>
'''Specifies a base service request to register one or more products in a batch operation.
'''</Summary>
<Api(Description:="Specifies a base service request to register one or more products in a batch operation.")>
Public Partial Class BatchRegisterProductsBase
Implements IPost
Public Sub New()
Products = New List(Of Product)
End Sub
'''<Summary>
'''The products to register.
'''</Summary>
<ApiMember(Description:="The products to register.", IsRequired:=true)>
Public Overridable Property Products As List(Of Product)
End Class
End Namespace
End Namespace
VB.NET BatchRegisterProducts 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 /sync/products/batch HTTP/1.1
Host: taxfiling.pwc.de
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
products:
[
{
id: 0,
index: 0,
name: String,
version: String,
description: String,
tags:
[
String
]
}
]
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length [ { product: { id: 0, index: 0, name: String, version: String, description: String, tags: [ String ] }, orders: [ { id: 0, productId: 0, accountId: 0, name: String, serviceName: String, requestTimestamp: 0001-01-01, responseTimestamp: 0001-01-01, requestUri: String, requestHttpMethod: String, requestDuration: PT0S, responseStatusCode: Continue, clientIPAddress: String, unitOfMeasurement: String, processType: String, dataType: String, dataName: String, creationDate: 0001-01-01, expiryDate: 0001-01-01, isTest: False } ], responseStatus: { errorCode: String, message: String, stackTrace: String, errors: [ { errorCode: String, fieldName: String, message: String, meta: { String: String } } ], meta: { String: String } } } ]