You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Vivek <vi...@retailreco.com> on 2017/09/16 09:51:43 UTC

How to create rest api service in ofbiz

hi ,

https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+Tutorial+-+A+Beginners+Development+Guide#OFBizTutorial-ABeginnersDevelopmentGuide-CreateYourFirstApplication(HelloWorld...)


i follow this link to make service and events. in this i have no problem.

now i want to ask -

how can i make rest api to get ofbiz entity data ( product , order , 
party) in json format for third party.

Thanks
Vivek tiwari

Re: How to create rest api service in ofbiz

Posted by Aditya Sharma <ad...@hotwaxsystems.com>.
Hi Vivek,

You can also get json response with controller like this
<request-map uri="test-request">
       <security https="false" auth="false"/>
       <event type="service" invoke="serviceName"/>
       <response name="success" type="request" value="json"/>
</request-map>

internally CommonEvents.jsonResponseFromRequestAttributes converts response
to json response so it has to be redirected to json uri.

<request-map uri="json">
        <security direct-request="false"/>
        <event type="java" path="org.ofbiz.common.CommonEvents"
invoke="jsonResponseFromRequestAttributes"/>
        <response name="success" type="none"/>
    </request-map>

Thanks and Regards,

*Aditya Sharma* | Enterprise Software Engineer
HotWax Commerce <http://www.hotwax.co/> by HotWax Systems
<http://www.hotwaxsystems.com/>
Plot no. 80, Scheme no. 78 Part 2, Near Brilliant Convention Center, Indore,
M.P, India - 452010
Cell phone: +91 7415786147

<https://www.linkedin.com/in/aditya-sharma-78291810a/>
<https://www.facebook.com/divinecreatureaaditya>
<https://www.instagram.com/iamaadi7/>

HotWax Systems recently received 8 mentions in *The Gartner Digital
Commerce Vendor Guide, 2016 *by Gartner, Inc., the world's leading IT
research and advisory company. Learn more about our research here
<https://www.gartner.com/technology/media-products/newsletters/HotWax/1-2UVLP6M/index.html>
.

<http://www.hotwax.co/>

On Mon, Sep 18, 2017 at 6:42 PM, Chandan Khandelwal <
chandan.khandelwal@hotwaxsystems.com> wrote:

> Hi Vivek,
>
> Here is the reference code block of request to get JSON output. You could
> simply write service to prepare and return information as needed. HTH!
>
>      <request-map uri="test-request">
>         <security https="false" auth="false"/>
>         <event type="service" invoke="serviceName"/>
>         <response name="success" type="view" value="JSONOutput"/>
>     </request-map>
>
> --
> Thanks & Regards,
> Chandan Khandelwal
> HotWax Systems
> Direct: +91-9893481076
> http://www.hotwaxsystems.com/
>
> On Sat, Sep 16, 2017 at 3:52 PM, Jacques Le Roux <
> jacques.le.roux@les7arts.com> wrote:
>
> > This http://markmail.org/message/rhnrge4xh7ctcd4e (did not try)
> >
> > You can also use a json response in a controller, look for the same in
> > existing controllers
> >
> > Jacques
> >
> >
> >
> > Le 16/09/2017 à 11:51, Vivek a écrit :
> >
> >>
> >> hi ,
> >>
> >> https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+Tuto
> >> rial+-+A+Beginners+Development+Guide#OFBizTutorial-ABeginner
> >> sDevelopmentGuide-CreateYourFirstApplication(HelloWorld...)
> >>
> >>
> >> i follow this link to make service and events. in this i have no
> problem.
> >>
> >> now i want to ask -
> >>
> >> how can i make rest api to get ofbiz entity data ( product , order ,
> >> party) in json format for third party.
> >>
> >> Thanks
> >> Vivek tiwari
> >>
> >>
> >
>
>
> --
> Thanks & Regards,
> Chandan Khandelwal
> HotWax Systems
> Direct: +91-9893481076
> http://www.hotwaxsystems.com/
>

Re: How to create rest api service in ofbiz

Posted by Chandan Khandelwal <ch...@hotwaxsystems.com>.
Hi Vivek,

Here is the reference code block of request to get JSON output. You could
simply write service to prepare and return information as needed. HTH!

     <request-map uri="test-request">
        <security https="false" auth="false"/>
        <event type="service" invoke="serviceName"/>
        <response name="success" type="view" value="JSONOutput"/>
    </request-map>

-- 
Thanks & Regards,
Chandan Khandelwal
HotWax Systems
Direct: +91-9893481076
http://www.hotwaxsystems.com/

On Sat, Sep 16, 2017 at 3:52 PM, Jacques Le Roux <
jacques.le.roux@les7arts.com> wrote:

> This http://markmail.org/message/rhnrge4xh7ctcd4e (did not try)
>
> You can also use a json response in a controller, look for the same in
> existing controllers
>
> Jacques
>
>
>
> Le 16/09/2017 à 11:51, Vivek a écrit :
>
>>
>> hi ,
>>
>> https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+Tuto
>> rial+-+A+Beginners+Development+Guide#OFBizTutorial-ABeginner
>> sDevelopmentGuide-CreateYourFirstApplication(HelloWorld...)
>>
>>
>> i follow this link to make service and events. in this i have no problem.
>>
>> now i want to ask -
>>
>> how can i make rest api to get ofbiz entity data ( product , order ,
>> party) in json format for third party.
>>
>> Thanks
>> Vivek tiwari
>>
>>
>


-- 
Thanks & Regards,
Chandan Khandelwal
HotWax Systems
Direct: +91-9893481076
http://www.hotwaxsystems.com/

Re: How to create rest api service in ofbiz

Posted by Jacques Le Roux <ja...@les7arts.com>.
This http://markmail.org/message/rhnrge4xh7ctcd4e (did not try)

You can also use a json response in a controller, look for the same in existing controllers

Jacques


Le 16/09/2017 à 11:51, Vivek a écrit :
>
> hi ,
>
> https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+Tutorial+-+A+Beginners+Development+Guide#OFBizTutorial-ABeginnersDevelopmentGuide-CreateYourFirstApplication(HelloWorld...) 
>
>
>
> i follow this link to make service and events. in this i have no problem.
>
> now i want to ask -
>
> how can i make rest api to get ofbiz entity data ( product , order , party) in json format for third party.
>
> Thanks
> Vivek tiwari
>