Getting a strange API error when trying to post an image. Why?

Following are the details:

 

curl https://connect.squareup.com/v2/catalog/object \
-X POST \
-H 'Square-Version: 2020-04-22' \
-H 'Authorization: Bearer [XXX_HIDDEN]' \
-H 'Content-Type: application/json' \
-d '{
"idempotency_key": "xxx",
"object": {
"id": "7JDYZEWSERLR36SU7NYXSDOI",
"type": "IMAGE",
"present_at_all_locations": true,
"present_at_location_ids": [
"HIDDEN"
],
"version": 15[Redacted]2,
"image_data": {
"caption": "Crab",
"name": "Crabby",
"url": "https://cdn11.bigcommerce.com/s-hgmqs37keq/images/stencil/original/products/117/3268/10897_Holy_Crab..."
}
}
}'

 

THis is the response I am getting.  What does this error mean?

 

{
"errors": [
{
"category": "INVALID_REQUEST_ERROR",
"code": "INVALID_VALUE",
"detail": "Invalid object: Invalid Object with Id: 7JDYZEWSERLR36SU7NYXSDOI\n[merchant_token=HIDDEN] Updated object 7JDYZEWSERLR36SU7NYXSDOI has incorrect type 2 (1 expected)."
}
]
}

1,383 Views
Message 1 of 3
Report
2 REPLIES 2

I realized that the ID it is expecting is the ID of the image.  However, I am trying to create a new image, so how can there be an ID?

1,347 Views
Message 2 of 3
Report
Admin

Hey @hiolife-

 

Thanks for posting in the Seller Community. 

 

I escalated this to our API team, and they said they believe the issue is occurring because you're using the URL: https://connect.squareup.com/v2/catalog/object, when you should be using: https://connect.squareup.com/v2/catalog/images

 

I hope this helps. Let me know if not! 💡

Square Champions Logo
Isabelle
Square Community Manager
Learn about the Square Champions program here.
1,323 Views
Message 3 of 3
Report