When uploading a new CatalogImage (API doc), is there any point at pre-specifying the url attribute? In this Java API example, the user seems to be creating a CatalogImage in the following way:
CatalogImage requestImageImageData = new CatalogImage.Builder()
.caption("A picture of a cup of coffee")
but based on the fact that the aforementioned API documentation says that the
url is generated after we upload the image using the
CreateCatalogImage endpoint, I’m not sure what the benefit of supplying this information ahead of time is good for. It reminds me of the
#-prefixed IDs that one has to use for newly uploaded
CatalogObject instances; those are no longer accessible after we supply them, and they are replaced by IDs Square gives us, which are guaranteed unique across the entire catalog.
Yeah, you’re right, I don’t think there is any reason to supply
url beforehand, as it won’t be useable (you can’t supply your own url for example with an image, that won’t work). I think the “Example” is just showing how you can supply the fields, but not necessarily the best use of the object.
Another question came to mind: when we make a
GET request for a
CatalogImage, is the
url field populated with a publicly accessible URL (like, e.g an AWS S3 URL)? Or do I perhaps have to somehow build that URL myself, based on additional information?
The URL will be generated for you, and it will be publicly accessible via AWS S3.