You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by "Prathamesh Joshi." <pr...@vrhythmstech.com> on 2016/01/28 10:08:58 UTC

Inserting new records(entities) in OData 2.0 using Olingo



Hi all ,

 I need to insert new record in database using existing OData
service. I came across ODataSingleProcessor.createEntity(PostUriInfo uriInfo, InputStream
content, String requestContentType, String contentType) API
which shows me how to write entity.  Please guide me how to call this
API. 
Suppose I have product service deployed on server
then,





1) While filtering it sends parameters in $filter
argument similarly for insert operation what is the format of URI
required so that createEntity method will  be invoked ?
2)
Similarly I need to implement UPDATE and DELETE operations too.
3)
Is this the correct way to achieve my goal ? If yes then any link to it
will be appreciated.

 
4) From browser side I am using basic HTML
and JS to call OData service. I dont see any JS API support from olingo
for V2.0. Guide me to client side consumption as well for
V2.0.
--

Thank you.

Prathamesh Joshi.

+91 9960 414 777

Re: Inserting new records(entities) in OData 2.0 using Olingo

Posted by "Prathamesh Joshi." <pr...@vrhythmstech.com>.




Thank you Michael.

 
________________________________________________

From:"mibo" <mi...@apache.org>

Sent:user@olingo.apache.org

Date:Fri, January 29, 2016 12:08 pm

Subject:Re: Inserting new records(entities) in OData 2.0 using Olingo





<style type="text/css">
.bodyclass{font-family:-apple-system,Helvetica,Arial,sans-serif;}blockquote{margin:0;padding:0
0 0 12px;border-left:1px solid
#aaa;color:#aaa;}hr.unibox-forward{border:0;color:#888;background-color:#888;height:1px;}</style>


	
		Hi Joshi,
	
		 
	
		Yes, you do a POST request with the data (e.g. as JSON) as body
(payload) to the according EntitySet URL.
	
		Olingo then dispatches this request to the â&euro;žODataResponse
createEntity(â&euro;¦)â&euro;&oelig; method of your
â&euro;žEntitySetProcessorâ&euro;&oelig; implementation for
processing by the service developer.
	
		Now the service developer has to handle by itself the creation of the
data in e.g. a database.
	
		However Olingo provides methods to parse/deserialize the body via the
EntityProvider (e.g.
â&euro;žreadEntry(â&euro;¦):ODataEntryâ&euro;&oelig;).
	
		Afterwards you have to send back the according response via an
â&euro;žODataResponseâ&euro;&oelig; object which contains
the HTTP status code (e.g. 201 created) and the new created entity (e.g.
as JSON) as response body payload.
	
		 
	
		
			Best Regards,
		
			Michael
	
	
		 
	
		 
	
		 
	
		 
	
		 
	
		
			On Jan 29, 2016, at 6:54 AM, Prathamesh Joshi. wrote:
		
			 
		Thanks. It was very
helpful. 

		From the the OData specification it seems that we have to send data in
body of POST request with corresponding content - type.

		And further this data can be extracted in createEntity() method.

		 ________________________________________________

		From:"V.A, Chandan"

		Sent:"user@olingo.apache.org"

		Date:Thu, January 28, 2016 7:30 pm

		Subject:RE: Inserting new records(entities) in OData 2.0 using Olingo

		

		 
		
			
				
					Hi,
				
					For points 1 and 2 refer
				1)http://olingo.apache.org/doc/odata2/tutorials/Olingo_Tutorial_BasicWrite.html-
Explains how to implement write scenarios2)http://www.odata.org/documentation/odata-version-2-0/operations/-
Explains how to consume the OData service.
				
					 
				
					Thanks
				
					Kind Regards
				
					Chandan
				
					 
				
					From:Prathamesh Joshi.
[mailto:prathameshj@vrhythmstech.com]

					Sent:Thursday, January 28, 2016 2:39 PM

					To:user@olingo.apache.org

					Subject:Inserting new records(entities) in OData 2.0 using
Olingo
				
					 
				
Hi all ,

				I need to insert new record in database using existing OData service.
I came across ODataSingleProcessor.createEntity(PostUriInfo uriInfo,
InputStream content, String requestContentType, String
contentType)API which shows me how to write entity. Please
guide me how to call this API.
Suppose I have product service
deployed on server then,

				

				

				1) While filtering it sends parameters in $filterargument
similarly for insert operation what is the format of URI required so
that createEntitymethod will be invoked ?
2) Similarly I
need to implement UPDATE and DELETE operations too.
3) Is this
the correct way to achieve my goal ? If yes then any link to it will
be appreciated.
4)

				From browser side I am
using basic HTML and JS to call OData service. I dont see any JS API
support from olingo forV2.0. Guide me to
client side consumption as well forV2.0.
--

				Thank you.

				Prathamesh Joshi.

				+91 9960 414 777
		
		
		
		--

		Thank you.

		Prathamesh Joshi.

		+91 9960 414 777






--

Thank you.

Prathamesh Joshi.

+91 9960 414 777

Re: Inserting new records(entities) in OData 2.0 using Olingo

Posted by mibo <mi...@apache.org>.
Hi Joshi,


Yes, you do a POST request with the data (e.g. as JSON) as body (payload) to the according EntitySet URL.
Olingo then dispatches this request to the „ODataResponse createEntity(…)“ method of your „EntitySetProcessor“ implementation for processing by the service developer.
Now the service developer has to handle by itself the creation of the data in e.g. a database.
However Olingo provides methods to parse/deserialize the body via the EntityProvider (e.g. „readEntry(…):ODataEntry“).
Afterwards you have to send back the according response via an „ODataResponse“ object which contains the HTTP status code (e.g. 201 created) and the new created entity (e.g. as JSON) as response body payload.


Best Regards,
Michael










> On Jan 29, 2016, at 6:54 AM, Prathamesh Joshi. <pr...@vrhythmstech.com> wrote:
> 
> 
> Thanks. It was very helpful. 
> From the the OData specification it seems that we have to send data in body of POST request with corresponding content - type.
> And further this data can be extracted in createEntity() method.
>  
> 
> ________________________________________________
> From:"V.A, Chandan" <ch...@sap.com>
> Sent:"user@olingo.apache.org" <us...@olingo.apache.org>
> Date:Thu, January 28, 2016 7:30 pm
> Subject:RE: Inserting new records(entities) in OData 2.0 using Olingo
> 
> 
> 
> 
> Hi,
> For points 1 and 2 refer
> 1)http://olingo.apache.org/doc/odata2/tutorials/Olingo_Tutorial_BasicWrite.html
> - Explains how to implement write scenarios
> 
> 2)http://www.odata.org/documentation/odata-version-2-0/operations/
> - Explains how to consume the OData service.
> 
>  
> Thanks
> Kind Regards
> Chandan
>  
> From:Prathamesh Joshi. [mailto:prathameshj@vrhythmstech.com]
> Sent:Thursday, January 28, 2016 2:39 PM
> To:user@olingo.apache.org
> Subject:Inserting new records(entities) in OData 2.0 using Olingo
>  
> Hi all ,
> I need to insert new record in database using existing OData service. I came across ODataSingleProcessor.createEntity(PostUriInfo uriInfo, InputStream content, String requestContentType, String contentType)API which shows me how to write entity. Please guide me how to call this API.
> 
> Suppose I have product service deployed on server then,
> 
> 
> 1) While filtering it sends parameters in $filterargument similarly for insert operation what is the format of URI required so that createEntitymethod will be invoked ?
> 
> 2) Similarly I need to implement UPDATE and DELETE operations too.
> 
> 3) Is this the correct way to achieve my goal ? If yes then any link to it will be appreciated.
> 
> 4)
> From browser side I am using basic HTML and JS to call OData service. I dont see any JS API support from olingo forV2.0. Guide me to client side consumption as well forV2.0.
> 
> --
> Thank you.
> Prathamesh Joshi.
> +91 9960 414 777
> 
> 
> 
> 
> 
> --
> Thank you.
> Prathamesh Joshi.
> +91 9960 414 777
> 
> 

RE: Inserting new records(entities) in OData 2.0 using Olingo

Posted by "Prathamesh Joshi." <pr...@vrhythmstech.com>.


Thanks. It was very helpful. 

>From the the OData specification it seems that we have to send data in
body of POST request with corresponding content - type.

And further this data can be extracted in createEntity() method.

 
________________________________________________

From:"V.A, Chandan" <ch...@sap.com>

Sent:"user@olingo.apache.org" <us...@olingo.apache.org>

Date:Thu, January 28, 2016 7:30 pm

Subject:RE: Inserting new records(entities) in OData 2.0 using Olingo





<style type="text/css">
-></style>


	
		Hi,For
points 1 and 2 refer1) 
http://olingo.apache.org/doc/odata2/tutorials/Olingo_Tutorial_BasicWrite.html
- Explains how to implement write scenarios2) http://www.odata.org/documentation/odata-version-2-0/operations/
- Explains how to consume the OData service. ThanksKind
RegardsChandan From:
Prathamesh Joshi. [mailto:prathameshj@vrhythmstech.com]

		Sent: Thursday, January 28, 2016 2:39 PM

		To: user@olingo.apache.org

		Subject: Inserting new records(entities) in OData 2.0 using
Olingo 
Hi all ,

		I need to insert new record in database using existing OData service. I
came across ODataSingleProcessor.createEntity(PostUriInfo
uriInfo, InputStream content, String requestContentType, String
contentType) API which shows me how to write entity. Please guide
me how to call this API.
Suppose I have product service deployed
on server then,

		

		

		1) While filtering it sends parameters in $filter
argument similarly for insert operation what is the format of
URI required so that createEntity
method will be invoked ?
2) Similarly I need to implement
UPDATE and DELETE operations too.
3) Is this the correct way to
achieve my goal ? If yes then any link to it will be
appreciated.
4)

		From browser side I am using basic HTML and JS to call
OData service. I dont see any JS API support from olingo for
V2.0. Guide me to client side consumption as well for
V2.0.
--

		Thank you.

		Prathamesh Joshi.

		+91 9960 414 777






--

Thank you.

Prathamesh Joshi.

+91 9960 414 777

RE: Inserting new records(entities) in OData 2.0 using Olingo

Posted by "V.A, Chandan" <ch...@sap.com>.
Hi,
For points 1 and 2 refer

1)       http://olingo.apache.org/doc/odata2/tutorials/Olingo_Tutorial_BasicWrite.html - Explains how to implement write scenarios

2)      http://www.odata.org/documentation/odata-version-2-0/operations/ - Explains how to consume the OData service.

Thanks
Kind Regards
Chandan

From: Prathamesh Joshi. [mailto:prathameshj@vrhythmstech.com]
Sent: Thursday, January 28, 2016 2:39 PM
To: user@olingo.apache.org
Subject: Inserting new records(entities) in OData 2.0 using Olingo


Hi all ,
 I need to insert new record in database using existing OData service. I came across ODataSingleProcessor.createEntity(PostUriInfo uriInfo, InputStream content, String requestContentType, String contentType) API which shows me how to write entity.  Please guide me how to call this API.

Suppose I have product service deployed on server then,


1) While filtering it sends parameters in $filter argument similarly for insert operation what is the format of URI required so that createEntity method will  be invoked ?

2) Similarly I need to implement UPDATE and DELETE operations too.

3) Is this the correct way to achieve my goal ? If yes then any link to it will be appreciated.


4) From browser side I am using basic HTML and JS to call OData service. I dont see any JS API support from olingo for V2.0. Guide me to client side consumption as well for V2.0.

--
Thank you.
Prathamesh Joshi.
+91 9960 414 777