Hi,
I have read the "web services" documentation.
http://documentation.progress.com/output/OpenEdge113/pdfs/dvwsv/dvwsv.pdf
Are there any sample projects available for REST applications?
I am just looking for a simple backend implementation like for example:
http://code.msdn.microsoft.com/Contact-Manager-Web-API-0e8e373d
So I can configure the AppServer etc. and run the code for demo purposes.
Just downloaded the latest samples (PROGRESS_OE_11.4_WIN_DOC.zip) but there is no sample available.
I am looking to create something like this:
http://localhost:8081/api/contacts/1 --> {"ContactId":1,"Name":"Glenn Block","Address":"1 Microsoft Way","City":"Redmond","State":"WA","Zip":"98052","Email":"gblock@microsoft.com","Twitter":"gblock","Self":"/api/contacts/1"}
Any suggestions on how to get started please? Thanks. Regards, Simon.
Sorry for the bad formatting. I tried to change it but I give up...
Hi Simon, I just tried to fix your formatting issue.
Hi Simon,
There is a step-by-step tutorial available online on the Progress Education site.
In lesson 2, you will learn how to create a REST Web application from an existing Progress OpenEdge ABL application. First, you will learn, how to annotate ABL resources and create a REST service. Next, you will learn how to map REST operations with ABL operations. Then, you will learn how to publish and test a REST service. Finally, you will learn how to export a REST Web application for deployment.
I have attached the exercise files related to this tutorial. This is a self-extracting archive. Your files should be extracted to C:\progress_education\openedge\REST.
Please let me know if you have any question.
Thanks, but I don't have a PEC account and I was hoping there would be an example somewhere in the docs/prokb?
Are you a partner, Simon?
Yes.
My understanding is that all partners are entitled to a PEC account. I have never used it, but there was some webinar thing that was posted there and I asked and got a sign in.
Hi Simon,
Please contact me at mcollins@progress.com, and I can look up if your company is registered/entitled to PEC seats.
Thanks,
-Margaret
Hello,
You may probably be all set on this.
Just in case, I wanted to give you some suggestions.
You can create a REST Service from Progress Developer Studio by creating a new OpenEdge project and using REST as the project type.
You can use an existing ABL program, or create a new ABL procedure or class file to use as a service interface.
You can use the Progress OpenEdge --> Define Service Interface wizard (right mouse click from the editor or Project Explorer) to add the annotations and export the the procedures or methods that you want.
Then you would use the Edit option of the Defined Services node in the Project Explorer to access the REST Resource URI Editor and define the URI and the mapping.
I am attaching a sample program that users the Customer table.
[View:~/cfs-file.ashx/__key/communityserver-discussions-components-files/19/customer_5F00_rest.p:550:0]
Here is a link to a video showing how to create the service:
[View:~/cfs-file.ashx/__key/communityserver-discussions-components-files/19/RESTServicePDSOE.mov:550:0]
Link: http://oemobiledemo.progress.com/rest/rest_service.mov
Note: This video corresponds to the same demo presented at the PUG Challenge Americas.
However, the recording at the PUG Challenge was only audio.
You can find the presentation at pugchallenge.org/downloads.html
Look for session 1468: Developing REST support for B2B access to your AppServer application
I hope this helps.
Thank you for your time to answer my question and the examples.
BTW
In customer_rest.p...
Why use the JsonArray instead of just using an output table for ttcustomer?
{"response":{"jsonText":"{\"CustNum\":1,\"Country\":\"USA\",\"Name\":\"Lift Tours\",\"Address\":\"276 North Drive\",\"Address2\":\"\",\"City\":\"Burlington\",\"State\":\"MA\",\"PostalCode\":\"01730\",\"Contact\":\"Gloria Shepley\",\"Phone\":\"(617) 450-0086\",\"SalesRep\":\"HXM\",\"CreditLimit\":66700.00,\"Balance\":903.64,\"Terms\":\"Net30\",\"Discount\":35,\"Comments\":\"This customer is on credit hold.\",\"Fax\":\"\",\"EmailAddress\":\"\"}"}}
(any idea why there are backslahes in the response?)
compared to:
{"response":{"ttcustomer":{"ttcustomer":[{"CustNum":1,"Country":"USA","Name":"Lift Tours","Address":"276 North Drive","Address2":"","City":"Burlington","State":"MA","PostalCode":"01730","Contact":"Gloria Shepley","Phone":"(617) 450-0086","SalesRep":"HXM","CreditLimit":66700.0,"Balance":903.64,"Terms":"Net30","Discount":35,"Comments":"This customer is on credit hold.","Fax":"","EmailAddress":""}]}}}
And why isn't there an option just to return:
{"CustNum":1,"Country":"USA","Name":"Lift Tours","Address":"276 North Drive","Address2":"","City":"Burlington","State":"MA","PostalCode":"01730","Contact":"Gloria Shepley","Phone":"(617) 450-0086","SalesRep":"HXM","CreditLimit":66700.0,"Balance":903.64,"Terms":"Net30","Discount":35,"Comments":"This customer is on credit hold.","Fax":"","EmailAddress":""}
Ok sorry, my question is explained in oemobiledemo.progress.com/.../rest_service.mov.
Sometimes you want to be able to return other structures than the temp-table itself and you can use the JsonArray for that.
And also my last question about returning the following output is answered.
You have to bind the JsonText directory to the Body.
Great!
{"CustNum":1,"Country":"USA","Name":"Lift Tours","Address":"276 North Drive","Address2":"","City":"Burlington","State":"MA","PostalCode":"01730","Contact":"Gloria Shepley","Phone":"(617) 450-0086","SalesRep":"HXM","CreditLimit":66700.00,"Balance":903.64,"Terms":"Net30","Discount":35,"Comments":"This customer is on credit hold.","Fax":"","EmailAddress":""}
Would you care to explain your last statement?
"You have to bind the JsonText directory to the Body."
Edit:
Sorry, missed it in the video (no soundcard on my computer).
In the rest-schema tool I had to connect the output to "Body" instead of directly beneath "body".
So:
Wrong:
Right:
Thx for pointing me in the right direction.
For me www.progress.com/.../Workshop%20-%20Progress%20Developer%20Studio%20For%20OpenEdge%20-%20Labs%20FINAL.pdf proved a usable intro.
--
Kind regards,
Stefan Houtzager
Houtzager ICT consultancy & development
www.linkedin.com/in/stefanhoutzager
I wonder, why people keeps using quicktime?
I can't see the video in any of explorer, chrome, firefox. .
Even I tought that quicktime was retired some time ago, as I being able to use the computer and see everything, with out never using quicktime in some 8 - 10 years or so..
I'll keep trying to install that piece of .... of quicktime, as I'm relly intereted on this tutorial.
Greetings you all!!
Hello,
I am sorry for the inconvenience.
The video was recorded using the built-in screen recording tool on Mac and the file was exported using the default option (H.264, AAC with an MOV extension).
This format can be played by Windows Media Player (without installing QuickTime).
Are you able to see the video?
Could you try downloading the video and playing it with Windows Media Player?
Here is a link to the file:
oemobiledemo.progress.com/.../rest_service.mov
Please let me know if you still have issues and I can try to covert the file to another format.
Thank you and regards.
Thanks for the tip....
Yes, indeed, I ended watching the tutorial in windows media, as you mention, after installing some full version of quicktime. It is a very clear and good intro to rest on OEPDS. I recommend it.
Thanks for good work.
Great.
You are welcome.
I am glad that you were able to watch the video and found it useful.
Thanks.
I found this thread very interesting.
I was looking for REST application sample project based on DataSet input-output parameter and Pacific Server but I couldn't find.
Is Business Entity class suitable for that purpose ?
What are REST applications adventages vs. Progress Data Objects.
Regards
Do you know any sample projects ?
Is Data Object Service more flexible and could be the future of REST service solutions ?
Thank you Ramadevi Dhavala. It's usefull.
What are the possiblities of advanced filtering of data in BE ? Is 'filter' parameter as a JSON descipted in documentation ?
For example, how can I define filter for few 'Customers' and their 'Orders' between 2 dates from Sports database ?
I know, I need 2 tables Dataset.
We can customize/extend our Business Entity (Read() method) to support to support filtering, sorting and paging operations via JSON Filter Pattern.
Additional Details:
We continue to use the same Read() operation (available in the Business Entity) which accepts filter string as the parameter. Only difference is that the client application sends an HTTP/S request to OpenEdge backend with an encoded JSON object having parameters for ablFilter, top, skip, etc.
The OpenEdge backend then runs the Read() method in the Business Entity (ABL business logic with code to support the parsing of the JSON object in the filter parameter) and returns a temp-table or a DataSet with the results set that corresponds to specified parameters.
Thank you Anil. Very instructive examples.
And could you help with my example, how to define filter for few 'Customers' and their 'Orders' between 2 dates from Sports database (2 tables dataset) ? - {"ablFilter":"Customer.CustNum>1 and Customer.CustNum<10 and Order.OrderDate>01/01/2016 and Order.OrderDate<02/01/2016"}