Platform API

<back to all web services

ManagePrimaryImage

Requires Authentication
The following routes are available for this service:
All Verbs/api/primaryimage
All Verbs/api/primaryimage/userprofile
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 SaveMediaResponse:
    # @ApiMember(DataType="Guid", Description="Media File Guid", Name="ErosMediaFileId", ParameterType="query")
    eros_media_file_id: Optional[str] = None
    """
    Media File Guid
    """


    # @ApiMember(DataType="string", Description="Media File Name", Name="MediaName", ParameterType="query")
    media_name: Optional[str] = None
    """
    Media File Name
    """


    # @ApiMember(DataType="string", Description="The original name of the media being saved.", Name="OriginalFileName", ParameterType="query")
    original_file_name: Optional[str] = None
    """
    The original name of the media being saved.
    """


    # @ApiMember(DataType="string", Description="Url of the media file.", Name="MediaFileUrl", ParameterType="query")
    media_file_url: Optional[str] = None
    """
    Url of the media file.
    """


    # @ApiMember(DataType="string", Description="Url of the media file thumbnail.", Name="MediaFileThumbnailUrl", ParameterType="query")
    media_file_thumbnail_url: Optional[str] = None
    """
    Url of the media file thumbnail.
    """


    # @ApiMember(DataType="ResponseStatus", Description="Service Stack Response Status.", Name="ResponseStatus", ParameterType="query")
    response_status: Optional[ResponseStatus] = None
    """
    Service Stack Response Status.
    """


@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 ManagePrimaryImage:
    # @ApiMember(DataType="Guid", Description="The licensee's contact Id linked to the media file.", IsRequired=true, Name="ContactIdOwner", ParameterType="query")
    contact_id_owner: Optional[str] = None
    """
    The licensee's contact Id linked to the media file.
    """


    # @ApiMember(DataType="MediaModel", Description="Primary image file to be uploaded including file type and content type.", IsRequired=true, Name="File")
    file: Optional[MediaModel] = None
    """
    Primary image file to be uploaded including file type and content type.
    """


    # @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="Blob storage container to which primary image file is to be uploaded.", IsRequired=true, Name="ContainerName")
    container_name: Optional[str] = None
    """
    Blob storage container to 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.
    """

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

{
	File: 
	{
		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
	},
	ContainerName: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	MediaName: String,
	OriginalFileName: String,
	MediaFileUrl: String,
	MediaFileThumbnailUrl: String,
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}