Test

<back to all web services

StoreLogs

import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Channel:
    name: Optional[str] = None
    value: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Device:
    id: int = 0
    type: Optional[str] = None
    time_stamp: int = 0
    channels: Optional[List[Channel]] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Logger:
    id: int = 0
    devices: Optional[List[Device]] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class StoreLogs:
    loggers: Optional[List[Logger]] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class StoreLogsResponse:
    existing_logs: Optional[List[Logger]] = None
    response_status: Optional[ResponseStatus] = None

Python StoreLogs DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /jsv/reply/StoreLogs HTTP/1.1 
Host: test.servicestack.net 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	loggers: 
	[
		{
			id: 0,
			devices: 
			[
				{
					id: 0,
					type: String,
					timeStamp: 0,
					channels: 
					[
						{
							name: String,
							value: String
						}
					]
				}
			]
		}
	]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	existingLogs: 
	[
		{
			id: 0,
			devices: 
			[
				{
					id: 0,
					type: String,
					timeStamp: 0,
					channels: 
					[
						{
							name: String,
							value: String
						}
					]
				}
			]
		}
	],
	responseStatus: 
	{
		errorCode: String,
		message: String,
		stackTrace: String,
		errors: 
		[
			{
				errorCode: String,
				fieldName: String,
				message: String,
				meta: 
				{
					String: String
				}
			}
		],
		meta: 
		{
			String: String
		}
	}
}