Need Canvas courses user-info course-info - canvas-lms

I'm new with Canvas lms and just wondering if anyone know how to get the user info and course id. need some examples
Below is the link I found, but still can't figure out how to use this in my php to grab the user info.
https://canvas.instructure.com/doc/api/file.object_ids.html
Thanks in advance.

Suppose you have the OAuth2 ACCESS-TOKEN and your USER-ID, you can simply use HTTP GET requests to obtain this information.
In order to get your user info, you need to perform a GET request to the following URL:
https://canvas.instructure.com/api/v1/users/<USER-ID>/profile?access_token=<ACCESS-TOKEN>
In order to get course id for the list of courses you belong to, you need to perform a GET request to the following URL: https://canvas.instructure.com/api/v1/courses?access_token=<ACCESS-TOKEN>
For more capabilities you can use the following API documentation:
https://canvas.instructure.com/doc/api/index.html

Related

Instagram Analyze via API or something else

for a master thesis I need to analyze several Instagram profiles with more than 1000 posts each.
I need a list of the following things:
Post Type (Image, Multi Image, Video)
description
Likes
Comments (count)
Is there a way to do this with the Instagram Api or do you have another idea how this can work?
Thank you so much
Torben
Sorry. Not easily possible. Facebook has disabled this feature. What parts of this that still work will likely be disabled. You could try to scrape the profiles yourself from the public HTML Instagram webpages.
Using the developer console in Google Chrome and analyzing the network traffic I found the following URL that might be able to do some of what you want. Looks like calling the /graphql/query/ URL with a JSON object as a query parameter labeled: variables, along with a hash of some kind of that object. Not sure if you can call it on your own, but I've had success with other embedded URLs like this. The ID is the users ID which you can get from the HTML as well.
I hope it helps somehow.
https://www.instagram.com/graphql/query/?query_hash=76d9c5f9c2d88aa251ece9ea61fdc570&variables=%7B%22id%22%3A%225466275%22%2C%22first%22%3A12%2C%22after%22%3A%22AQCqBkaT0gZcgV1z9nfTgM3saTJi3cDRQoQy2YM4SdWNWyo3kdMTfCzWvuGcGRI9e1WpAIquMMG9jeuuXSe0TSMiQMPIL1ZmVimTMQ0dfrD_9Q%22%7D
Decoded that is:
https://www.instagram.com/graphql/query/?query_hash=76d9c5f9c2d88aa251ece9ea61fdc570&variables={"id":"5466275","first":12,"after":"AQCNhv_lxGd-nHBBaZb5kk3J4N-n058NgyCiWDnJ10rLc2V-YrVUvGsiuXr4NsMQ4QDzOLdjbTIVqoMpspJ69r-0s-PzOceis9J25o8P2BcjdA"}

Send Multiple Parameters in REST GET call to resource

What's the best way to send multiple parameters on a REST GET resource call. Normally we can call GET call with path param &/ query however the number of character is limited on a URL so any suggestion or best practice on how to achieve this.
This can be achieved via POST where sending the query in request body as JSON and use json converter on the resource end. I am thinking POST mayn't be a right approach for query or get service from a resource.
I search the existing questions on this but didn't get any proper answer.
Thanks in advance.
You can send a limited data with GET and even the data is visible in URL making data vurnerable. When you use POST data is a alot more safer than GET and you can send large no. of request parameters. You can checkout this link

Retrieve list of user emails for specific node

during the process of discontinuing our node we need to retrieve the user emails in order to notify them to migrate their VM's.
We have tried using keystone user-list after sourcing our openrc config file but to no avail.
Is there a command sequence we should use in order to retrieve what we need?
There is an way to get the information about the users that can be using your node. The steps that you should follow are the following:
Get the id of your region from the GET to http://cloud.lab.fiware.org:4730/v3/OS-EP-FILTER/endpoint_groups
Get the complete list of projects in your region: GET to http://cloud.lab.fiware.org:4730/v3/OS-EP-FILTER/endpoint_groups/{{Region-Id}}/projects where Region-id comes from endpoints_groups[i].id in the previous JSON response.
Get the user of those project, for each project: GET to http://cloud.lab.fiware.org:4730/v3/role_assignments?scope.project.id={{project_id}}, where project_id comes from projects[i].id in the previous JSON response.
Get detailed information of the user: GET to http://cloud.lab.fiware.org:4730/v3/users/{{user-id} where user-id comes from role_assignments[i].user.id in the previous JSON response.
Keep in mind that all the operations have to be done with the corresponding X-Auth-Token.
I hope that it can help you.

Parsing website source HTML file using Swift

I've been using String(contentsOfURL: NSURL) to retrieve the HTML file of a website (a post on Instagram like this one https://instagram.com/p/5FcnSATPa4/ in my case). I need some information about the post like how many likes the post has received or the location associated with the photo.
This line of the HTML file, for example, contains some of the info I need \"location\":{\"has_public_page\":true,\"name\":\"Kaputa\\u015f Beach\". The question is: how can I extract that "Kaputa Beach" name?
Thank you.
Why not use the actual Instagram API? https://instagram.com/developer/endpoints/likes/
Why spend time parsing the HTML when you get that information straight from the source.
You can authorise using OAuth (https://github.com/dongri/OAuthSwift)
You could retrieve a list of users who have liked an image using the call below, you can then derive the 'like' count from this:
https://api.instagram.com/v1/media/{media-id}/likes?access_token=ACCESS-TOKEN
Alternatively if you want more information on the media, you can use the following endpoint:
https://api.instagram.com/v1/media/{media-id}?access_token=ACCESS-TOKEN
Details here: https://instagram.com/developer/endpoints/media/#get_media
Here is an example of a swift app using the Instagram API, you can check out the project on GitHub to see how it works.
https://maniacdev.com/2015/01/example-a-swift-based-ios-instagram-photo-downloader-and-browser
EDIT:
You don't need to authenticate as a particular user to use the methods you need.
Login to instagram as yourself:
https://instagram.com/accounts/login/
Register a new client: https://instagram.com/developer/clients/manage/
Use your new client id with requests instead of your access token:
https://api.instagram.com/v1/media/{media-id}/likes?client_id={CLIENT_ID}
or
https://api.instagram.com/v1/media/shortcode/5FcnSATPa4?client_id={CLIENT_ID}
You can make up to 5000 requests per hour with your client id.
You can play around with the Instagram API here: https://apigee.com/console/instagram
Just remember to use your client id.

Retrieving 'Likes' programmatically

I am doing an analysis of Credit Union social activity. I have some code that takes a link like this...
https://www.facebook.com/americanlakecu/likes
... and converts it to this...
http://graph.facebook.com/americanlakecu
..which enables me to grab 'Likes' and 'People Talking'. The problem is many institutions, particularly the smaller ones, seem to use a different format. Here's an example.
https://www.facebook.com/pages/EvergreenDIRECT-Credit-Union/276887662722?sk=likes
Anyone know how to convert the link above so I can use the api to render JASON in the same way as http://graph.facebook.com/americanlakecu ?
You need to reference the facebook id when hitting the graph for the other institutions. For americanlakecu, that id is americanlakecu. For Evergreen's case, try 276887662722. But for some reason, your "smaller" pages need an access token. I think the difference might be a simple matter of availability of data.
You can still get their data as I described above, but you need an api access token. For instance, following this link directly will show you nothing: http://developers.facebook.com/tools/explorer/?method=GET&path=276887662722 , but after you get there, if you fetch an access token, you will see all the info you need.
So, configure your implementation of the SDK to use an access token, and you ought to be able to continue using the handy graph method.