We are working in the office using Oracle APEX to create some web services. After beating our heads against the wall we finally figured out that the terms get & post when talking about RESTful services are not the same as standard HTTP.
We will need to create two types of web services;
In the first, the external application passes a few fields and the method queries a record and sends the data back to the external application.
In the second an external application builds a 30 field record that needs to be inserted by the method into the DB.
In a normal web app we would in both cases typically http post the data to to a cgi (asp, aspx, pl...) page that would parse the fields and do what needs to be done.
Since we have written the new app in APEX, and we would like to join the late 20th century, we thought we would use a web service on the provider side. The consumer will be AS3/flex/flash.
Can we still use the traditional http post and/or http get methodology of defining name=data pairs and send them to the web service?
What we have seen so far is that the data passed (at least in an APEX Restful GET) needs to be positional and not name=data pairs.
I guess the first question is where can we get some basic concepts on how to pass data using "RESTful" get & post? Something aimed at a web service dolt would be good.
Another question is if the HTTP get/post methodolgy can be used, how would it be done in Oracle APEX v5.0?
There is a lot of questions inside your post, perhaps if you narrow it down to a specific problem, you'd get better answers. I've used RESTful services with APEX 4.2, 5, 5.1 and they work just fine.
In the first, the external application passes a few fields and the method queries a record and sends the data back to the external application.
This is typical GET request. You pass the parameters (I usually pass them as part of the URL), use them in query, and return the values. You can even pass them to PL/SQL block, do whatever processing you need, then return the results.
In the second an external application builds a 30 field record that needs to be inserted by the method into the DB.
This is typcial POST request (although you still can use GET but not recommended). The format of how the data is being sent is important. I've done that using JSON format, and received as bind variable :body at APEX end. In APEX you can parse it and insert it into a table.
Few resources might help you to get going:
http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/apex/r50/Restful%20Services/restful_services.html#section1
This is especially helpful for POST:
https://ruepprich.wordpress.com/2016/03/22/apex-rest-post/
I want to store information for every request made to my site. For example USER_AGENT etc. Like google analytics do. And then I want to expose that information using rest-API. Is their any APP for this.???
I am creating a django application for my company, and one of the things that still needs doing is a survey.
At the moment we use SurveyMonkey, but I can't manage to send via api invitations to the surveys(personalized ones like the web page allows, so we know who answered with which answers).
Does anybody know if it's possible to do this with SurveyMonekey api, or if not, any other django app that what I need, or another way to do this?
SurveyMonkey's API is currently read-only and does not allow adding users to email collectors. And option you might consider is pairing SurveyMonkey with MailChimp. MailChimp currently has docs on how to use it with SurveyMonkey here: http://kb.mailchimp.com/article/setting-up-your-surveymonkey-mailchimp-integration/
You could also create something like the MailChimp API in your own application by adding a unique ID to links you send to your respondents by appending ?c=UNIQUEID to the end of a web link collector URI. Then, in your application, you can send any email invitation you like to potential respondents and use the unique ID to correlate users with responses.
You'll need to request the "custom_id" by adding it to the "fields" array in your request to get_respondent_list in order to that unique ID back from SurveyMonkey using the API.
I randomly pick two friends of the user and ask him/her to pick who is the better friend. Now all I have is the friend ID which I then have to use to create a poll and store in the database accordingly. Using the Facebook graph API, I have the ID. All I need to do now is to pass it to Django.
I'm new to this so how exactly would I do that? Pass a javascript variable to Django?
I see two options.
At client side using Javascript SDK,
Fetch the friends' profile details along with ID.
Convert them to JSON.
Do a POST request to a django url/view which stores the data in database.
In this way, you don't need to do any graph API queries further from server side. But this won't help you updating the data at realtime. Consider, if one of the friends changing his name in FB, now what is stored in your database becomes obsolete. So, you need to make sure that some thing from client side implemented to do real time update posts to server side.
At server side using any django facebook graph API apps,
Get the IDs from client side.
Use the fb graph app to fetch the details at server side.
Store them in database.
In this way, you could be able to schedule a callback for real time updates. I prefer the second approach as it's always better to burden the server rather than client. And I found this app simple and do what you need. https://pypi.python.org/pypi/django-facebook-api/0.1.10
Description of how a webhook works from http://webhooks.pbwiki.com/ -
How do they work?
By letting the user specify a URL for various events, the application will POST data to those URLs when the events occur...Among other things, you can:
create notifications to you or anybody via email, IRC, Jabber, ...
put the data in another app (real-time data synchronization)
process the data and repost it using the app's API
validate the data and potentially prevent it from being used by the app
Who is using web hooks?
DevjaVu, BitBucket, GitHub, Shopify, Versionshelf, PayPal (IPN), Jott (Links), IMified, PBwiki, Facebook (Platform, sort of), Mailhook.org, SMTP2Web, Astrotrain, Notifixious, Assembla, ZenDesk, Google Code
Do you know of any good uses of webhooks?
AlertGrid is the webhook consumer. You can configure it to accept http calls from ANY source and raise alert (email, sms, phone) to a specified person or group of people (works worldwide!) whenever the parameters in the http callback meet your criteria or when the http call was expected but it didn't occur (kind of 'heartbeat' monitoring). There is a visual editor for you to easily create rules.
Apart from notifying people by sms or email it can also notify existing applications by sending the http requests to their APIs.
It can also visualise data received in http callbacks and show the history.
Unfortunately, the wiki is not the most up to date list of known implementations. I have my own list that I'll put on the wiki when I get around to reorganizing it. Some not mentioned in the current list:
Dropbox
Gnip
Google Code (Project Hosting)
Checkout by Amazon (both for notifications and as actual callbacks with return data)
Hubilicious
Beanstalk
Google Checkout
MailChimp
SurveyGizmo
Hey!Watch
MySpace (for app developers)
I know shopify is using webhooks quite successfully now. By extension so is fetchapp uses them as well. You either are sending an xml file, or receiving one and doing your own processing logic on it.
Oh and shopify's wiki in the link has a whole write up about how to implement it in your app.
OfficeAutopilot has an interesting version of webhooks.. they use their rule interface to trigger API posts. Can trigger in response to any system event.. email opens, clicks, page visits, purchases, etc, etc.
Kiln 1.2 uses webhooks much like GitHub, BitBucket, etc.
(Disclaimer: I'm a Kiln/FogBugz dev.)
Say for example you want to get data from any API( eg. twitter, facebook etc.,). Instead of you polling the data for every few minutes/seconds, it POSTS the data to the specified URL, whenever it is available.
By using this, you will avoid unnecessary polling like say you poll and data is not there yet.
StorageRoom is a JSON-based CMS that supports webhooks, so that you can notify other services or kick of some manual processing on your own servers.
(Please note: I created the service myself)
If you want to connect one service that supports webhooks to another service's API, you can check out IronWorker's webhook support. Here's a blog post that walks through connecting github webhooks to HipChat:
http://blog.iron.io/2012/04/one-webhook-to-rule-them-all-one-url.html
There are some other examples here too, one that takes a chargify callback and posts to Campfire.