Skip to Content

The Media service in Yaas could be used to store your media files. Here we will try it step by step.


1. Subscribe the Media service in your dev team.

1.PNG


2. Create a new service in your dev team with the scope “hybris.media_view” and “hybris.media_manage”.

1.PNG


3. Get the “Client ID” and “Client Secret” of your service. And the “Identifier” of your dev team as the tenant.

1.PNG

1.PNG

4. Execute the following command in your cmd window to get the token. PAY ATTENTION that the red part should be changed to your own id and secret.

curl -i -H “Content-Type: application/x-www-form-urlencoded” -X POST -d “grant_type=client_credentials&scope=hybris.media_manage hybris.media_view&client_id=xxxxxx&client_secret=xxxxxhttp://api.yaas.io/hybris/oauth2/v1/token

1.PNG


5. To upload a file to media repository, firstly we need to send a post request to https://api.yaas.io/hybris/media/v2/files to get the upload link and commit link. PAY ATTENTION that for the Authorization part, the token should be started with “Bearer”. The body indicates that the type of the file that you want to upload.

{

    “Content-Type”: “application/vnd.ms-excel”

}

1.PNG

1.PNG

Then you will get the upload link and the commit link as response. The upload link is used to upload the file. After that the file is temporally stored in media repository. You need to send a request to the commit link to make the uploading finalized.

1.PNG


6. Send a put request to the upload link to upload the file.

1.PNG

1.PNG


7. Send a post request to the commit link to commit the file. Then you will get the id and link of the media file.

1.PNG


8. You can get the real download link of the file by sending a get request to the link.

1.PNG

1.PNG

9. To see the list of the files in your media repository, you can send a get request to https://api.yaas.io/hybris/media/v2/files?tenant=congdevteam, PAY ATENTION that the red part should be changed to your own tenant.

1.PNG

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply