| POST | /api/attachments |
|---|
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using Eros.Saguna.Common.WebAPIModel.ServiceModels;
using Eros.Saguna.Common.WebAPIModel.Models;
namespace Eros.Saguna.Common.WebAPIModel.Models
{
public partial class MediaModel
{
public virtual Guid MediaFileId { get; set; }
public virtual string MediaName { get; set; }
public virtual string FileContent { get; set; }
public virtual string FileContentType { get; set; }
public virtual string FilePath { get; set; }
public virtual string OriginalFileName { get; set; }
public virtual int ImageWidth { get; set; }
public virtual int ImageHeight { get; set; }
public virtual int FileSizeKB { get; set; }
public virtual string BlobUriRaw { get; set; }
public virtual string BlobUriFull { get; set; }
public virtual string BlobUriThumbnail { get; set; }
public virtual string WatermarkUri { get; set; }
public virtual DateTime CapturedDate { get; set; }
public virtual Guid? CapturedByContactId { get; set; }
public virtual string CapturedByContactName { get; set; }
public virtual string CapturedByContactThumbnailUrl { get; set; }
public virtual string Notes { get; set; }
public virtual string ResourceActionName { get; set; }
public virtual string LocationVerified { get; set; }
public virtual Guid TrafficLightLocationVerified { get; set; }
public virtual string AudienceLevel { get; set; }
public virtual string WorksFor { get; set; }
}
}
namespace Eros.Saguna.Common.WebAPIModel.ServiceModels
{
public partial class AddAttachments
{
///<summary>
/// including file content, file type, content type and connected object.
///</summary>
[ApiMember(DataType="string", Description=" including file content, file type, content type and connected object.", Name="Files", ParameterType="query")]
public virtual List<MediaModel> Files { get; set; }
///<summary>
///Appliance from which primary image file is to be uploaded.
///</summary>
[ApiMember(DataType="Guid", Description="Appliance from which primary image file is to be uploaded.", IsRequired=true, Name="ApplianceId")]
public virtual Guid ApplianceId { get; set; }
///<summary>
///Object for which primary image is to be uploaded.
///</summary>
[ApiMember(DataType="Guid", Description="Object for which primary image is to be uploaded.", IsRequired=true, Name="ConnectedObjectId")]
public virtual Guid ConnectedObjectId { get; set; }
///<summary>
///Licensee Id of the Object owner for which primary image is to be uploaded.
///</summary>
[ApiMember(DataType="Guid", Description="Licensee Id of the Object owner for which primary image is to be uploaded.", IsRequired=true, Name="ConnectedObjectLicenseeId")]
public virtual Guid ConnectedObjectLicenseeId { get; set; }
}
public partial class AddAttachmentsResponse
{
public virtual ResponseStatus ResponseStatus { get; set; }
}
}
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 /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
}
}
}