Platform API

<back to all web services

AddAttachments

Requires Authentication
The following routes are available for this service:
POST/api/attachments
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 AddAttachmentsResponse:
    response_status: Optional[ResponseStatus] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class MediaModel:
    media_file_id: Optional[str] = None
    media_name: Optional[str] = None
    file_content: Optional[str] = None
    file_content_type: Optional[str] = None
    file_path: Optional[str] = None
    original_file_name: Optional[str] = None
    image_width: int = 0
    image_height: int = 0
    file_size_k_b: int = 0
    blob_uri_raw: Optional[str] = None
    blob_uri_full: Optional[str] = None
    blob_uri_thumbnail: Optional[str] = None
    watermark_uri: Optional[str] = None
    captured_date: datetime.datetime = datetime.datetime(1, 1, 1)
    captured_by_contact_id: Optional[str] = None
    captured_by_contact_name: Optional[str] = None
    captured_by_contact_thumbnail_url: Optional[str] = None
    notes: Optional[str] = None
    resource_action_name: Optional[str] = None
    location_verified: Optional[str] = None
    traffic_light_location_verified: Optional[str] = None
    audience_level: Optional[str] = None
    works_for: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddAttachments:
    # @ApiMember(DataType="string", Description=" including file content, file type, content type and connected object.", Name="Files", ParameterType="query")
    files: Optional[List[MediaModel]] = None
    """
     including file content, file type, content type and connected object.
    """


    # @ApiMember(DataType="Guid", Description="Appliance from which primary image file is to be uploaded.", IsRequired=true, Name="ApplianceId")
    appliance_id: Optional[str] = None
    """
    Appliance from which primary image file is to be uploaded.
    """


    # @ApiMember(DataType="Guid", Description="Object for which primary image is to be uploaded.", IsRequired=true, Name="ConnectedObjectId")
    connected_object_id: Optional[str] = None
    """
    Object for which primary image is to be uploaded.
    """


    # @ApiMember(DataType="Guid", Description="Licensee Id of the Object owner for which primary image is to be uploaded.", IsRequired=true, Name="ConnectedObjectLicenseeId")
    connected_object_licensee_id: Optional[str] = None
    """
    Licensee Id of the Object owner for which primary image is to be uploaded.
    """

Python AddAttachments 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 /api/attachments HTTP/1.1 
Host: pfapi.pstpf.com.au 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Files: 
	[
		{
			MediaName: String,
			FileContent: String,
			FileContentType: String,
			FilePath: String,
			OriginalFileName: String,
			ImageWidth: 0,
			ImageHeight: 0,
			FileSizeKB: 0,
			BlobUriRaw: String,
			BlobUriFull: String,
			BlobUriThumbnail: String,
			WatermarkUri: String,
			CapturedDate: 0001-01-01,
			CapturedByContactId: 00000000000000000000000000000000,
			CapturedByContactName: String,
			CapturedByContactThumbnailUrl: String,
			Notes: String,
			ResourceActionName: String,
			LocationVerified: String,
			AudienceLevel: String,
			WorksFor: 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
		}
	}
}