How to upload an image using Photo API
Summary
Here are different examples to upload a new photo using Photo API
Procedure
1: ANS from file, no ID
curl --request POST \
--url https://api.{{org}}.arcpublishing.com/photo/api/v2/photos \
--header 'Authorization: Bearer ' \
--header 'Content-Type: multipart/form-data' \
--form ans=@/Users/test/Documents/photo_ans_test.json
2: ANS from file, ID in ANS, no ID in URL path
curl --request POST \
--url https://api.{{org}}.arcpublishing.com/photo/api/v2/photos \
--header 'Authorization: Bearer ' \
--header 'Content-Type: multipart/form-data' \
--form ans=@/Users/test/Documents/photo_ans_test2.json
3: ANS from file ID in ANS, ID in URL path
curl --request POST \
--url https://api.{{org}}.arcpublishing.com/photo/api/v2/photos/B3BTTESTNAWNYEUP2VOBDINLPI \
--header 'Authorization: Bearer ' \
--header 'Content-Type: multipart/form-data' \
--form ans=@/Users/test/Documents/photo_ans_test3.json
4: ANS from JSON, ID in ANS, ID in URL path
curl --request POST \
--url 'https://api.{{org}}.arcpublishing.com/photo/api/v2/photos/B4BTTESTNAWNYEUP2VOBDINLPI?=' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--data '{
"_id": "B4BTTESTNAWNYEUP2VOBDINLPI",
"version": "0.10.7",
"type": "image",
"owner": {
"id": "{{org}}"
},
"additional_properties": {
"originalUrl": "https://images.unsplash.com/photo-1654452698901-cf57845dd7a7"
}
}'
5: ANS from JSON, no ID in ANS
curl --request POST \
--url 'https://api.{{org}}.arcpublishing.com/photo/api/v2/photos' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--data '{
"version": "0.10.10",
"type": "image",
"owner": {
"id": "{{org}}"
},
"additional_properties": {
"originalUrl": "https://images.unsplash.com/photo-1654452698901-cf57845dd7a7"
}
}'