Moodle Data Request - moodle

I want to pass the user id (100) to moodle and then get a JSON string about the stored data of the user with the id (100). Is there a way or a web service for this?
Thx

First of all, you need to enable Moodle web services, you can follow this link, then add the "core_user_get_users" function to your external web service, then you can create criteria to search and get user data.
Samples:
webservice endpoint: https://<MOODLE_URL>/webservice/rest/server.php?wstoken=<YOUR_TOKEN>&wsfunction=core_user_get_users&moodlewsrestformat=json&criteria[0][key]=username&criteria[0][value]=<USERNAME>
webservice endpoint: https://<MOODLE_URL>/webservice/rest/server.php?wstoken=<YOUR_TOKEN>&wsfunction=core_user_get_users&moodlewsrestformat=json&criteria[0][key]=id&criteria[0][value]=<ID>
For other response formats change "moodlewsrestformat" in the request.

Related

Using a Web activity along with a linked service to call a rest api

I have to send data to a rest API via data factory.
I get batches of records from a database, send them in the body of the REST API call, which provides a response that informs the action performed on each record.
I created a linked service to the base API URL, and this linked service does the authentication to the API.
My question is how I use this linked service along with a web activity in a pipeline?
The web activity requires me to enter a full URL, which feels redundant as the base URL is already in the linked service.
The web activity does let me add multiple linked services but I'm unsure why it allows multiple linked services and how this is supposed to work.
I would appreciate expertise regarding how the web activity works with a linked service.
Thanks!

How to send additional data(location) along with the customer registration form on flutter app using JWT auth plugins' REST API?

I am new to flutter and am trying to post customers' location along with the registration from currently i am fetching the location from Google Map. Am not sure that I can POST location along with the current registration form. WordPress plugin - JWTs' REST API is using to register user, for other purposes like product fetching, category fetching I have used WooCommerce REST API. Just to clear out my question - Can I POST location along with customer registration form on flutter application using JWT auth plugin because currently i don't see any specific columns to save location. Hope you all can understand my question.
Is does not seems to be possible with your current setup as the endpoint is not allowing location data to be send.
If you need the location data to be send, you can either created another server (seperated from wordpress) that will communitcate to the wordpress instance and handle authentication. or find another wordpress plugin that enables you to customize the input of a certain endpoint.

Regarding REST API

I'm new to REST APIs and trying to understand the basics of them. So lets begin by saying that I have created a simple CMS web application using PHP (You create an user, you post an entry and assign some categories maybe, etc...).
That being said, if I wanted to create a mobile app that would do the same, I'll have to create some PHP functions in order to send data as JSON or XML and also in order to process a POST or PUT request.
is a REST API the collection of those functions I'd use to handle the mobile app POST, PUT and GET request using JSON or XML as the data format? if not, can I get an example, not a definition, please.
To answer your question,yes, the REST API is a collection of those functions for any client you wish to expose it to for creating an user, posting an entry etc. The accepted data format is something you decide for your API. It may be JSON, XML or even both.
Some examples:
http://coenraets.org/blog/2011/12/restful-services-with-jquery-php-and-the-slim-framework/
http://peter.neish.net/building-a-mobile-app-backend-using-mongodb-and-slim-a-php-rest-framework/

REST related query- for use in Java web app

I am trying to create a REST API using Java.
Now, for the front end, I am using socialauth, so that facebook/twitter/yahoo/hotmail/gmail users can sign in to the application.
After a user is signed in, he should be able to access the data for his account- I want to create a REST API that enables each user to access his data. I have understood the basics of creating a REST API using Jersey framework, however how do I ensure that only a user who is correctly logged in to the application, can access data via the REST API?
What I thought of is, I will store the user's email ID in session, when he logs in. And whenever he makes a request to the API, the email ID in session is passed as a input parameter to the REST API, and the REST API checks that data is asked for same email ID, as the email ID parameter.
Is the above way of thinking correct? What is the recommended/best way to implement REST API in the scenario as given above?

How can I fetch data from facebook using a query string in salesforce?

How can I fetch data from facebook using a query string in salesforce?
This is what I have:
I am not fetching data so what can I do?
Have you called Http's send method after this?. I guess you have but are not getting any response back?
Any external site you call from Apex must be registered in the Remote Site Settings. Make sure to add Facebook's URL under Admin Setup > Security Controls > Remote Site Settings