[DOCU-536] Uploading binaries with REST Created: 10/Sep/14  Updated: 04/Feb/16  Resolved: 02/Feb/16

Status: Closed
Project: Documentation
Component/s: content
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Neutral
Reporter: Antti Hietala Assignee: Ruth Stocks
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File asset.json     File asset_jcrContent.json     JPEG File dog.jpg     File logo-asset.json     File logo-jcrcontent.json     PNG File logo.png    
Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Date of First Response:
Sprint: Docu Sprint 6

 Description   

Add an example of uploading binaries using REST. There's a JSON example with binary payload in MGNLREST-47.

Forum thread: PUT/POST request of content, How to define a video object with JSON?



 Comments   
Comment by Ruth Stocks [ 27/Jan/16 ]

I tested this by doing the following:

  1. Uploaded an asset in the Assets app (dog.jpg attached)
  2. GET request in the Swagger tool to get the info.
  3. Deleted asset in the Assets app.
  4. Created the asset node in Swagger tool with asset.json (attached). This works fine.
  5. Attempted to add the binary and other data in Swagger tool with asset_jcrConent.json (attached). This returns a 400 response code.

I also tried with pmundt files attached to MGNLREST-47 with the same result.

Comment by Ruth Stocks [ 02/Feb/16 ]

With Phillips help I got this working and it's now documented at https://documentation.magnolia-cms.com/display/DOCS/REST+API#RESTAPI-Creatingassets

  • the files for testing are attached (logo.png, logo-asset.json, logo-jcrcontent.json.
  • I don't have curl installed so adapted the code from previous examples, but have not tested it.
  • I have tested it in the swagger tool and it works
  • the code block macro has syntax highlighting even though it is set to none. Other code blocks on the page with the same settings do not have highlighting.
Comment by Christoph Meier [ 04/Feb/16 ]

The upload examples on the docs. page works fine for me with swagger and finally it works with cURL as well. I had to remove some empty lines (which lead to a fail) and removed not mandatory properties such as identifier to make it easier.

Now it looks fine for me.

Generated at Mon Feb 12 01:10:01 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.