Associating Images to Products

Presently, this API only supports a single image per product. You can attach the image to a product in the following fashion (see below).

curl --globoff \
  --request POST \
  --url 'https://api-g.weedmaps.com/catalog/v1/product_images?scope_by[organization_id]=ORGANIZATION_ID' \
  --header 'accept: application/vnd.api+json' \
  --header 'authorization: Bearer [ACCESS_TOKEN HERE]' \
  --header 'content-type: application/vnd.api+json' \
  --data '{
    "data": {
      "attributes": {
        "image_url": "https://picsum.photos/id/237/600/400.jpg",
      },
      "relationships": {
        "product": {
            "data": {
            "id": "[PRODUCT_ID HERE]",
            "type": "products"
          }
        }
      },
      "type": "product_images"
    }
  }'

Troubleshooting

Weedmaps runs a couple of validations to ensure images can be downloaded in the most performant and secure fashion. Prior to reaching out, please make sure all of the items below are true.

HEAD Requests

When you provide us an image URL, we send a HEAD request to it as a way to ensure the image can be downloaded. The response must return a 200 in order for us to proceed. If you're having difficulty getting your images to return a 200 response, please reach out to your image service provider to see what options you can have. At this time, Weedmaps cannot resolve this issue on your behalf and there is nothing we can do.

Image Formats

When we attempt to download an image, we compare the image format (JPG or PNG) provided in your response headers against the file that's provided. If those values don't match, we don't download the image.

For example, your image file may return an image with a "Content-Type" of image/jpg, but when we check the file, it's an image/png. You can check the true content type for an image by running something like the following on a downloaded file:

file -b --mime-type ~/path/to/image.png