Trendsic Platform Service

<back to all web services

InsertInvoiceRequest

Requires Authentication
Requires any of the roles:Agent, Administrator
The following routes are available for this service:
POST,OPTIONS/v1/invoice
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 Invoice:
    invoice_i_d: int = 0
    invoice_u_i_d: Optional[str] = None
    project_u_i_d: Optional[str] = None
    invoice_number: Optional[str] = None
    invoice_date: Optional[datetime.datetime] = None
    due_date: Optional[datetime.datetime] = None
    from_name: Optional[str] = None
    from_phone: Optional[str] = None
    from_email: Optional[str] = None
    from_address: Optional[str] = None
    from_desc: Optional[str] = None
    to_name: Optional[str] = None
    to_phone: Optional[str] = None
    to_email: Optional[str] = None
    to_address: Optional[str] = None
    to_desc: Optional[str] = None
    notes: Optional[str] = None
    currency: Optional[str] = None
    status: int = 0
    total: Optional[Decimal] = None
    is_paid: Optional[bool] = None
    paid_date: Optional[datetime.datetime] = None
    is_deleted: Optional[bool] = None
    is_locked: Optional[bool] = None
    created_date: Optional[datetime.datetime] = None
    modified_date: Optional[datetime.datetime] = None
    created_by_u_i_d: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InvoiceLineItem:
    invoice_line_item_i_d: int = 0
    invoice_i_d: int = 0
    type: Optional[str] = None
    name: Optional[str] = None
    quantity: Optional[int] = None
    percentage_adjust: Optional[Decimal] = None
    amount_adjust: Optional[Decimal] = None
    price: Optional[Decimal] = None
    description: Optional[str] = None
    notes: Optional[str] = None
    is_taxable: Optional[bool] = None
    display_order: Optional[int] = None
    is_locked: Optional[bool] = None
    is_deleted: Optional[bool] = None
    is_paid: Optional[bool] = None
    created_date: Optional[datetime.datetime] = None
    modified_date: Optional[datetime.datetime] = None
    created_by_u_i_d: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InsertInvoiceRequest:
    invoice: Optional[Invoice] = None
    line_items: List[InvoiceLineItem] = field(default_factory=list)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InvoiceIdentification:
    invoice_id: int = 0
    invoice_uid: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InsertInvoiceResponse:
    response_status: Optional[ResponseStatus] = None
    new_invoice_identification: Optional[InvoiceIdentification] = None

Python InsertInvoiceRequest 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 /v1/invoice HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Invoice: 
	{
		InvoiceID: 0,
		InvoiceUID: 00000000000000000000000000000000,
		ProjectUID: 00000000000000000000000000000000,
		InvoiceNumber: String,
		InvoiceDate: 0001-01-01,
		DueDate: 0001-01-01,
		FromName: String,
		FromPhone: String,
		FromEmail: String,
		FromAddress: String,
		FromDesc: String,
		ToName: String,
		ToPhone: String,
		ToEmail: String,
		ToAddress: String,
		ToDesc: String,
		Notes: String,
		Currency: String,
		Status: 0,
		Total: 0,
		IsPaid: False,
		PaidDate: 0001-01-01,
		IsDeleted: False,
		IsLocked: False,
		CreatedDate: 0001-01-01,
		ModifiedDate: 0001-01-01,
		CreatedByUID: 00000000000000000000000000000000
	},
	LineItems: 
	[
		{
			InvoiceLineItemID: 0,
			InvoiceID: 0,
			Type: String,
			Name: String,
			Quantity: 0,
			PercentageAdjust: 0,
			AmountAdjust: 0,
			Price: 0,
			Description: String,
			Notes: String,
			IsTaxable: False,
			DisplayOrder: 0,
			IsLocked: False,
			IsDeleted: False,
			IsPaid: False,
			CreatedDate: 0001-01-01,
			ModifiedDate: 0001-01-01,
			CreatedByUID: 00000000000000000000000000000000
		}
	]
}
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
		}
	},
	NewInvoiceIdentification: 
	{
		InvoiceId: 0,
		InvoiceUid: 00000000000000000000000000000000
	}
}