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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to upload JSON asset using Asset API

MatStyler
Level 2
Level 2

Hi. I am using AEM Assent API and trying to upload a binary file using HTTP request.

 

Here you can find the docs: https://docs.adobe.com/content/help/en/experience-manager-65/assets/extending/mac-api-assets.html#cr...

 

It's working for images but for every json files i am uploading, it's creating new directory with name of the file instead of uploading this file. Any suggestions? How the request should looks like?

 

 

1 Accepted Solution
Veena_Vikram
Correct answer by
Community Advisor
Community Advisor

@MatStyler Thanks for following up. I tried this out.  When we give Content-Type : "application/json" , it is creating a folder , So I tried with a generic type as Content-Type:"application" and it worked ✌😉

Even though it throws me error , file actually got uploaded 

 

Veena_Vikram_0-1596050170307.png

Veena_Vikram_1-1596050215537.png

 

Hope this works for you ✌

Thanks

Veena

 

View solution in original post

4 Replies
Veena_Vikram
Community Advisor
Community Advisor

Hi @MatStyler 

 

   Recently I tried out Asset API myself and tried to put it in a video for others if it helps. Please check it how to upload asset here https://youtu.be/NL-2WqitHUE?t=835 

 

Hope this helps

Veena ✌

MatStyler
Level 2
Level 2
It's ok for images but when i am uploading json this way it's creating a directory, not uploading the json file.
ankushb21155798
Employee
Employee

 

If I understand you correctly are you are trying to create an asset outside any folder , and  are seeing that the curl command is creating a folder instead of a node name?

MatStyler
Level 2
Level 2
It's working with images (uploading an image) but not for jsons.
Veena_Vikram
Correct answer by
Community Advisor
Community Advisor

@MatStyler Thanks for following up. I tried this out.  When we give Content-Type : "application/json" , it is creating a folder , So I tried with a generic type as Content-Type:"application" and it worked ✌😉

Even though it throws me error , file actually got uploaded 

 

Veena_Vikram_0-1596050170307.png

Veena_Vikram_1-1596050215537.png

 

Hope this works for you ✌

Thanks

Veena

 

View solution in original post

MatStyler
Level 2
Level 2
Yeah, it's working but returning the error so it's not a good solution but a hack.
Veena_Vikram
Community Advisor
Community Advisor
I tried checking the logs why exactly it is throwing error. But didn't find anything specifically logged or may be i missed.