Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Assets 6.4 HTTP API - Upload asset

Avatar

Avatar
Level 1
RobertoPrimo
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
RobertoPrimo
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

0 solutions
View profile
RobertoPrimo
Level 1

11-04-2020

Hi all,

 

In the AEM Assets documentation it is written that a new asset can be created with the following POST request:

POST /api/assets/myFolder/* -F"name=myAsset.png" -F"file=@myPicture.png"

 

Could you please provide more information on what is expected as a value for file property? I have tried uploading it with a path to the image, but every time I try to create an asset I end up creating a new folder.

 

What is the correct way to upload an asset via HTTP API?

 

All the best!

AEM 6.4 API Assets HTTP-API upload
View Entire Topic

Avatar

Avatar
Give Back 5
Level 4
SameerBhalerao
Level 4

Likes

35 likes

Total Posts

30 posts

Correct Reply

16 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Boost 5
Boost 3
View profile

Avatar
Give Back 5
Level 4
SameerBhalerao
Level 4

Likes

35 likes

Total Posts

30 posts

Correct Reply

16 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Boost 5
Boost 3
View profile
SameerBhalerao
Level 4

02-06-2020

Hi There,

 

How are you firing your POST? Using curl? Postman?

 

It is necessary to have a folder pre-existing where you want to upload an image.

 

For example I use following command from curl console and it works:

curl http://localhost:4502/api/assets/my-image123.jpeg -H"Content-Type: image/jpeg" --upload-file "preview_Monitor_template.psd" -v --user admin

 

Try --upload-file to pass binary file.

 

Thanks!