Access Moodle webservices - json

I am trying to communicate with a moodle2 instance via json web service protocol. I can't get it working, no matter how long I tried. I generated an API key which I use for calling the following url in my browser:
http://<moodle base url>/webservice/rest/server.php?wsfunction=get_course_contents&wstoken=<api key>&courseid=916
As there seems to be no developer documentation for accessing the API I read the source code and found the required param coursed for this function.
Calling this URL in my browser results in a white window - server returns simply nothing but accepts my url (no 404 or something similar). The server part must be up and running because the official Moodle app can somehow communicate with the instance.
What am I doing wrong? Is there a developer documentation listing all functions and their params?

My problem was our organization not allowing me to view the administrative backend. It includes a full documentation of all functions and services.
Regrettably this documentation is not mentioned anywhere on the internet (especially not on the noodle wiki / site).

Related

API Management Service can't find API definition

I'm trying to create a new API Management Service (AMS) on Azure. I'm facing an issue I have never had before. I have my OpenAPI file in a public URL. If I paste this URL to create a new APIs in AMS, I always receive an error
Unable to download specified file. Please ensure the URL is valid and the file is publicly accessible.
Then, I tried to download this OpenAPI definition from the Azure Console and it can reach the file and download it. This issue happens from yesterday before I could use the same OpenAPI file without problem.
Also, I checked the configuration of the Virtual Machine where the APIs are hosted. It seems correct and I can reach the file from a browser.
The error of unable to download ... perhaps comes from the ip address url, because when I fill the field with an azure storage blob url, I received no error.
And I saved your request response into a json file locally and upload it to apim, I got the error of unable to parse specified file, I found it resulted from missing servers.url.
I think you can try to add api instance by uploading json file from localhost.
After a long call with Microsoft support, I found the issue. In the Network Security Groups, I added a new Inbound Security Rule.
First, Source. I saw there is an option for Service Tag. If I select Service Tag, the following dropdown change the label in Source service tag. From this dropdown, you there is an option for ApiManagement.
Wrong choice. You have to allow select IP from the dropdown list and type the IP of the API Management Service.
I have create a post on my blog to explain step by step what you have to do. Hopefully, it could be useful.

Is a browser's console an interface to the web API?

From my research, the browser gives us some features that the JavaScript engine itself doesn’t provide: a Web API. This includes the DOM API, setTimeout, HTTP requests, and so on.
So because browsers run functions that are not supported in the JavaScript engine, like setTimeout for example, is it correct to say that the browser's terminal is an interface to the web and Web API.
Does that make sense, is that a constructive way to think about it?
I think that the WebAPI and the Console are two separate Things that both plug into the js-engine of your browser. The Console is not able to directly access the DOM for example, it can only execute javascript lines, that access the DOM internal and return a specific result (again returned via javascript)

Google Docs viewerng api reference

I am trying to show a file hosted in a public site inline on my web page using google docs by providing the following URL to an iframe.
https://drive.google.com/viewerng/viewer?url='+link+'&embedded=true
where link is the path to the file I want to show.
I am facing some issues with showing files which require user authentication.
Hence would like to see reference documentation for the API. I searched for it online was unable to find any reference documentation for the following service end point.
"https://drive.google.com/viewerng/viewer"
Let requests originating from this Google service pass your authentication
Include a secret parameter in the link to confirm that an authenticated user (of your site) is requesting the document (via viewerng)

How to send apprequest using actionscript without FB.ui or PHP?

I am building an App in Flash using graph API, I would like to post a request to increase count next to the app bookmark (as detailed here: http://developers.facebook.com/docs/requests/), all the documentation refer to either:
server-side (PHP SDK) where there is no problem using the 'app secret' to retrieve app_access_token, or
using FB.ui which requires user interaction, which is not what I am trying to do.
Is there a way to send an apprequests (App to User) via JS SDK only?
Could it be that this feature does not work in sandbox mode?
UPDATE: solved. worked it out.
I use the server to retrieve the app_access_token (only for a valid logged in user), once having app_access_token there is no problem using standard api calls from within flash.
UPDATE: solved. worked it out.
I use the server to retrieve the app_access_token (only for a valid logged in user), once having app_access_token there is no problem using standard api calls from within flash.

Chrome Extension: log in in options page

i'm trying to make a chrome extension and I need the have an options page where the user is able to login. this way the extension knows who he is and can retrieve specific data from a server.
I'm not sure how to do this. Any one has a tutorial page or, better yet, a sample code?
thank you all!
A number of extensions use OAuth or OpenID for authentication. There is a tutorial for OAuth on code.google.com. You could also just use a username/password and make a XHR request to validate them. It really depends on the site and what authentication methods it offers.
You need an authentication engine... In other words you need to have a backend for your chrome extension which handles logging in and logging out. This is extremely easy to do. You can use a backend as a service if it's a small project (look at Parse or Firebase) or write your own backend using a framework like Ruby on Rails.
http://rubyonrails.org/; https://www.parse.com/; https://www.firebase.com/
Options pages are well documented on the official docs, including sample code.