CreateCatalogImage
Uploads an image file to be represented by a CatalogImage object linked to an existing CatalogObject instance.
Table Specific Information
If you want to create an image without attaching to any Catalog Object
EXECUTE CreateCatalogImage ImageFile = 'C:\\users\\image.png', ImageDataCaption = 'Test Image'
You can upload and attach image to a catalog object by specifying the objectid.
EXECUTE CreateCatalogImage ImageFile = 'C:\\users\\image.png', ImageDataCaption = 'Test Image', ObjectId = 'KGV3QARAJSYCIX4VUJZX64ZX'
You can also suppy the image using its base64 representation using the FileData and FileName parameters.
EXECUTE CreateCatalogImage FileName = 'TestFile.png', FileData = 'iVBORw0KGgoAAAANSUhEUgAAAw8AAAFoCAMAAAAmbDcvAAAABGdBTUEAALGPC==', ImageDataCaption = 'Sample Test Image';
You can also suppy the image by providing an instance of InputStream using the Content and FileName parameters.
In order to specify the value for ImageCatalogV1Ids, you need to create a well defined JSON structure
EXECUTE CreateCatalogImage ImageFile = 'C:\\users\\image.png', ImageDataCaption = 'Test Image', ImageCatalogV1Ids = '[{"catalog_v1_id":"KGV3QARAJSYCIX4VUJZX64ZX","location_id":"29BYHNBR6W77E"}]'
Input
| Name | Type | Required | Description |
| ImageFile | String | False | An image file in JPEG, PJPEG, PNG, or GIF format. |
| ObjectId | String | False | Unique ID of the CatalogObject to attach to this CatalogImage. Leave this field empty to create unattached images |
| ImageAbsentAtLocationIds | String | False | A comma separated list of locations where the object is not present, even if present_at_all_locations is true. This can include locations that are deactivated. |
| ImageCatalogV1Ids | String | False | The Connect v1 IDs for this object at each location where it is present, where they differ from the object's Connect V2 ID. The field will only be present for objects that have been created or modified by legacy APIs. |
| ImageDataCaption | String | True | A caption that describes what is shown in the image. |
| ImageDataName | String | False | The internal name to identify this image in calls to the Square API. |
| ImageDataUrl | String | False | The URL of this image, generated by Square after an image is uploaded using the CreateCatalogImage endpoint. |
| PresentAtAllLocations | Boolean | False | If true, this object is present at all locations (including future locations), except where specified in the absent_at_location_ids field. If false, this object is not present at any locations (including future locations), except where specified in the present_at_location_ids field. If not specified, defaults to true. |
| PresentAtAllLocationIds | String | False | A comma separated list of locations where the object is present, even if present_at_all_locations is false. This can include locations that are deactivated. |
| ObjectVersion | Integer | False | The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
| FileName | String | False | The file name including extension when using Content. |
| FileData | String | False | Base64 string representation of the image content to be used along with FileName. Only used if ImageFile and Content are not set. |
Result Set Columns
| Name | Type | Description |
| Success | Boolean | Whether or not the image was attached to the item. |
| ImageId | String | Id of the Image. |
| ImageUrl | String | The url of the uploaded image. |
| ImageCaption | String | The caption of the uploaded image. |
| CreatedAt | Datetime | The time at which the image is uploaded. |
| IsDeleted | Boolean | Tells whether the image is deleted or not. |
| PresentAtAllLocations | Boolean | Tells whether the uploaded image is present at all locations or not. |
| Type | String | The type of the uploaded image. |
| UpdatedAt | Datetime | The time at which the uploaded image is updated. |
| Version | String | The version of the uploaded image. |