You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by Jonathan Bayle <jo...@gael.fr> on 2016/03/04 15:35:15 UTC

Create Media resources

Dear list,

In the sample code of the write scenario example [1], there is a comment 
that says:

```No support for media resources```

My questions are, does Olingo 2 support creation of media resources? how 
can I add support for media resources creation in my server code?

Thanks.

Regards, Jonathan.

---

[1] 
http://olingo.apache.org/doc/odata2/tutorials/Olingo_Tutorial_BasicWrite.html

RE: Create Media resources

Posted by "Amend, Christian" <ch...@sap.com>.
Hi Jonathan,

in order to do this you need to enhance your createEntity method. There you need to read the input stream differently in case you receive a create for a media resource. You read the input stream however you like since it can be anything. Then you save it in your database. Finally you also create the entry in your database and send back the initial entry as a response to the client.

The way media entities work is that on client side the request is a POST on the EntitySet with the media resource as the payload. In return the server should save the media resource and send back the initial entry which was linked with this media resource. Then a client can go ahead and change the fields he would like similar to any other update he would send to a server. So to create a media entry you always need 2 requests from client side.

Best Regards,
Christian

-----Original Message-----
From: Jonathan Bayle [mailto:jonathan.bayle@gael.fr] 
Sent: Freitag, 4. März 2016 15:35
To: user@olingo.apache.org
Subject: Create Media resources

Dear list,

In the sample code of the write scenario example [1], there is a comment 
that says:

```No support for media resources```

My questions are, does Olingo 2 support creation of media resources? how 
can I add support for media resources creation in my server code?

Thanks.

Regards, Jonathan.

---

[1] 
http://olingo.apache.org/doc/odata2/tutorials/Olingo_Tutorial_BasicWrite.html