Is it possible to have my app communicate with moodle? - java

I am thinking about building a student app, that would use Moodle data, and notify the user when a new file has been uploaded, and perhaps do something like checking your grades etc.
I'm quite new to android programming and can get easily confused with the technical terms. I've looked around the web and found that there is an API, but I dont really 100% know what that means. Which is weird since I've communicated with API's like the OpenWeatherMap one and uTorrent. Would Moodle's api do the same? Make it easier for me to get their data? Their descriptions are really technical and I can not understand much.

Please note that "API" in moodle does not automatically refer to webservices like you are used to communicate with.
See https://docs.moodle.org/32/en/Mobile_web_services and https://docs.moodle.org/32/en/Using_web_services and https://docs.moodle.org/dev/Web_service_API_functions
These docs might be interesting for you.
Beside the existing webservice methods, you can also create your own moodle plugin, which provides the methods required, some info can be found here https://docs.moodle.org/dev/Adding_a_web_service_to_a_plugin

Related

Does REST doc have to contains all possible values of each request parameter?

When it comes to write REST doc documentations, is it good to write all possible values of each request parameter? I think it's better even though there are many other ways to get the information like source codes. But I am not sure. Is there correct answer, or it's just a matter of team policy?
I think the answer to that question is depends on the project that you are working on. If this API will be used by many other developers and open to everyone, I think it would be better to put a few example code snippets by using a different language and explain each parameter like what is used for and the limits that should be considered. I think you don't need to put all possible combinations after simply explain each parameter itself. You may look at popular projects API documentation to get an idea; for example :
Github API Documentation
Twitter API Documentation
Dropbox API Documentation
These documentations are giving every detail that a developer needs. If this API is only for your small team and you don't need such detailed explanations you may use Swagger like tools to easily document your API.
Swagger
I completely agree with the above, just wanted to add another handy thing. You might want to have Postman Collection with all the test case scenarios. This will come handy when you will want to share it with the team or QA. There is a practice to keep the Postman Collections in source control and to update them as needed.

OData4J and AppEngine

Does anyone have a very simple example of using OData4J and GAE?
In the OData4J site there is a stub project for use in GAE...but doesn't really show how to expose entities out of the datastore as odata entities.
I may be missing something with that stub project(I'm sure I am)...but just need a little jump start on how to publish my persisted entities.
Thanks
MJD
Take a look at http://code.google.com/p/odata-appengine/
Maybe it's just what you're looking for.
the odata4j-appengine sample project in the repository shows how to expose existing appengine datastore kinds as odata open-typed entities.
See appengine-web.xml for how it's configured.
If you need any additional help, feel free to post to our discussion group at odata4j-discuss.
Thanks,
- John
unfortunately, it looks like no one has written and published such example code yet. google has only 127 results for odata4j "app engine", and the vast majority are unrelated mentions that happen to be on the same page.
so, you may be in unexplored territory here, at least as far as the internet is concerned. if you do end up writing example code yourself, feel free to post it here so others can benefit!

Implement repository service in java

I want to have a repository of Url to music(audio and video) with different file types (mp3,ogg,flv,avi) which can be used as a web-service.
Is there a free or open source solution for a repository (for example written in Java) which could help me, or do you have some recommendations, or patterns that could help me?
I'm not completely clear on what you are asking, but this sounds like a good use case for a NoSQL document store. If I were you, I'd be looking into things like CouchDB, MongoDB, Amazon S3 , etc.
CouchDB provides an HTTP interface via RESTful calls to your documents. So you could store your media in it, and you'd have a URL for each media element. There are Java libraries to support it, plus it's just REST with JSON, so it is really easy to get it working with Java. Personally, I use Jackson for JSON processing.
I'm not sure about a pure Java solution, perhaps JackRabbit? But it seems it may be overkill for your needs. It wouldn't be hard to roll your own. Perhaps use Jersey to implement REST, and then just store files on the filesystem. I guess it all depends on the scale you need.
Hope this helps.

Google Query from Java?

I'm writing a Java program, and I want a function that, given a string, returns the number of Google hits a search formed from that query returns. How can I do this? (Bonus points for the same answer but with Bing instead.)
For instance, googleHits("Has anyone really been far even as decided to use even go want to do look more like?") would return 131,000,000. (or however many there are.)
Related: How can I programmatically access the "did you mean" suggestion? (eg searching "teh circuz" returns "did you mean the circus?")
found it: http://code.google.com/apis/ajaxsearch/documentation/#fonje
The Google Terms of Service say this:
5.3 You agree not to access (or attempt to access) any of the Services
by any means other than through the
interface that is provided by Google,
unless you have been specifically
allowed to do so in a separate
agreement with Google. You
specifically agree not to access (or
attempt to access) any of the Services
through any automated means (including
use of scripts or web crawlers) and
shall ensure that you comply with the
instructions set out in any robots.txt
file present on the Services.
Google has ways of making life unpleasant for you / your company if you violate the Terms of Service ...
UPDATE: The second sentence is about the way that you use Google's services ... including their published APIs. It is not entirely clear from the wording what is allowed and what is forbidden; literally speaking "any automated means" is very broad. However a Java app that performed Google searches, screen-scraped the results and repackaged them to provide some value added service would (IMO) be a violation of the TOS. And using Google's published APIs to do the same thing would (IMO) also be a violation.
But that's my opinion, not Google's. And it is the Google opinion that matters. If anyone is thinking of doing something like this, they should contact Google and check that what they are proposing is OK.
The point is that Google is not going to assist people to subvert their search business model. Anyone who thinks they can get away with it based on some clever interpretation of the TOS is going to get burned.
for the first part of the answer, try read the t-o-s; for the "did you mean" part, see: http://norvig.com/spell-correct.html
You may be able to do it "legally" using the Google Java Client Library. I don't know for sure, but they may have some methods similar to what you're looking for, and you won't be violating their TOS.
Google Data APIs Library
You can legally access the Google AJAX Feed API through its RESTful interface:
http://code.google.com/apis/ajaxfeeds/documentation/#fonje
Bing still has a developer program where you can call against their API in a JSON/XML or SOAP matter:
http://www.bing.com/developers

Getting started with a custom JXTA PeerGroup

I have been working with JXTA 2.3 for the last year or so for a peer-to-peer computing platform I am developing. I am migrating to JXTA 2.5 and in the process I am trying to clean up a lot of my use of JXTA. For the most part, I approached JXTA with a just make it work attitude. I used it to jumpstart creating and managing my peer-to-peer overlay network and providing basic communication services. I would like to use it in a more JXTA way since I am making changes to move to 2.5 anyway.
My first step would be a basic creation of a custom PeerGroup. I see some new new mechanisms that are using the META-INF.services infrastructure of Java. Should I be listing a related PeerGroup implementing object here with a GUID in net.jxta.platform.Module? As I understand it, if I do this, when a group with a spec ID matching the GUID is encountered and joined or created it should automatically use the matching object. I should be able to just manually tie a PeerGroup object to the group but this new method using META-INF seems to be a lot easier to manage.
Does anyone have any pointers or examples of using this infrastructure for PeerGroup implementation? Also, some general information on the META-INF.services mechanism in Java would be helpful.
The META-INF.services stuff is known by its class name in the API: ServiceLoader. A Google search for ServiceLoader yields some information.
I am not really familiar with it, but sometimes it's all about knowing the right search keywords.

Categories

Resources