Retrieving Attachments

Retrieving attachments

Attachments should be retrieved in 2 steps:

  1. getting the attachment UUID from the object's field . e.g: Transaction.TSAMyImage1

  2. call pepperi.api.attachments.get ( while search can be used to get multiple images of certain item or category)

Get single attachment and list of attachments

Attachments are retrieved like a standard resource - the difference is in their optional fields and their response :

pepperi.api.attachments.get( { key:{UUID: ""}, fields:["UUID", "URI", "URL"]} )

Returns:

{ UUID : "659a8f38-9f8a-4286-b3dd-1973dd8c35b2",
  URI : ""
  URL:  "" }

Getting list of attachments :

pepperi.api.attachments.search (
{
fields:["UUID", "URI", "URL"],
filter: { ApiName: "URL", Operation : "Contains",
          Values : ["MyItem"]} ,
}
);

Returns:

{success: true, objects: 
[ {UUID: "aefb523e-74ac-4041-8bb1-a76a3b5e78d8" , URI:"" ,URL:"" },
  {UUID: "aefb523e-74ac-4041-8bb1-a76a3b5e78d8" , URI:"" ,URL:"" }
] }

URI: In case of native app it will return the base64 of the Binary Content in data-URI format (embedded base64 URI)

URL: Will always return the attachment's web URL- no matter what is the app type - web or native

Last updated