Google Classroom API create a link to the course - hyperlink

I am developing an agenda for my students. They are enrolled in different classes and have different courses in Google Classroom.
I am able to get the Classroom courses id, and get the grades. But I can not find information about how to link from my agenda to the course. Can I use the course id to create a link to the classroom course?
For example, if I get the courses list like this:
12012929120
12129399390
10101303003
Is there anyway to create a URL to go directly to that course? (For example: https://classroom.google.com/id/12012929120)
Or is any other way to retrieve my courses from the API and create links to my courses?

I'm pretty sure you can form a url like:
https://classroom.google.com/c/
So if you id was 12012929120 the url might be:
https://classroom.google.com/c/MTIwMTI5MjkxMjA=
But I just know that via experimentation with my own course so I can't guarantee that will always work. I couldn't find any docs to answer the question definitively when I was trying to figure it out for myself.

From the document, upon creating a classroom using Method: courses.create if the creation is successful the return value of this method is the classroom resource object which includes the alternateLink:
{
"id": string,
"name": string,
"section": string,
"descriptionHeading": string,
"description": string,
"room": string,
"ownerId": string,
"creationTime": string,
"updateTime": string,
"enrollmentCode": string,
"courseState": enum(CourseState),
"alternateLink": string,
"teacherGroupEmail": string,
"courseGroupEmail": string,
"teacherFolder": {
object(DriveFolder)
},
"courseMaterialSets": [
{
object(CourseMaterialSet)
}
],
"guardiansEnabled": boolean,
}
You can use the alternateLink to pass as a hyperlink for your classroom.
Hope this helps.

Related

How to represent flexible data models in Core Data?

I'm quite new to the world of data persistence and Core Data and I have a hard time representing a model for my app.
My app is a collection of forms and will feature a "template editor" that allows the user to choose what fields should these forms contain. For example, an user might want to create forms with the fields "name", "age" and "picture". Those three attributes can all be of different types (String, Int, and Data). Moreover, there's no guarantee what the user will select. They could add 45 different fields including custom ones (with their own titles) if they wanted.
My question is what would be an efficient way to model one of these forms in Core Data?
I thought about representing every attribute in the model, or making a dictionary attribute with all the fields… But since I'm a beginner, I'm afraid of making a wrong technical choice that could hurt the app's efficiency or ability to execute predicates, etc.
Thank you in advance 🙂
Since user can add n number of fields in a template, adding every fields into the DB is not good idea. This will lead to a big size and this will volute the db normalisation.
Better to convert the template into single json which can be stored in a file based on template name or id. If you have a DB already then you can link the file name into a user object. Same json can be used to upload to server or render the template again from the same json file.
Even you can position the fields based on id else even you can added position field in the json in order to maintain the field orders.
Example:
{
"template_id": "xyz",
"fields": {
"textfield": [
{
"label": "First Name",
"value": "Stack",
"id": 1
},
{
"label": "Last Name",
"value": "Overflow",
"id": 2
}
],
"image": [
{
"label": "Profile Photo",
"value": "/Document/Images/Profile.jpeg",
"id": 3
}
],
"date_picker": [
{
"label": "DOB",
"value": "01/01/1980",
"id": 4
}
]
}
}
Why not use this simple design for your models?. Here they are represented as structs but they are easily translated to entities
struct Form {
var name: String
var fields: [Field]
}
struct Field {
var name: String
var type: String //Maybe an enum in code
//var form: Form :in a struct you don't have this property but your entity will have it as a relationship
}
I believe dictionary model is best for this because you don't know what n how many fields user is going to use. But you can save those fields values in to string type and store it in ur core data.
Use Microsoft Excel to prototype and design a database. Once it's done, create your CoreData model.

How do I use $expand on ownerid to fetch SystemUser properties with the Dynamics 365 Web API?

I'm using Postman to query the Dynamics 365 Web API to fetch Account records. I'm trying to use expand to fetch some properties from the related SystemUser record via the ownerid field.
Here is what I think the query should look like:
https://myorg.api.crm4.dynamics.com/api/data/v9.0/accounts?$select=name&$expand=ownerid($select=fullname)
When I submit this query I get the error:
Could not find a property named 'fullname' on type 'Microsoft.Dynamics.CRM.principal
I know that the fullname property definitely exists on a SystemUser.
If I remove the ($select=fullname) part of the query I get the following JSON result but I was expect lots of properties for the expanded owner.
{
"#odata.context": "https://myorg.api.crm4.dynamics.com/api/data/v9.0/$metadata#accounts(name,ownerid)",
"value": [
{
"#odata.etag": "W/\"1564360\"",
"name": "My Account",
"accountid": "82b287d6-0dc7-e811-a95e-000d3ab1ab19",
"ownerid": {
"ownerid": "5f8872b1-0189-e811-a975-000d3ab38ab1"
}
}
]
}
If I change the expand to use primarycontactid then this works and I can fetch fields from a Contact record.
I've checked the documentation and I'm no further forward.
https://learn.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/query-data-web-api
How do I use expand to fetch properties from a SystemUser record via the ownerid property of Accounts?
It looks like the issue is due to the Owner field being able to point at either a SystemUser or Team record.
If I expand with owninguser then I can fetch the correct properties from the related Systemuser.
/api/data/v9.2/new_customs?$select=createdon,_ownerid_value&$expand=owninguser($select=fullname)&$filter=(owninguser/systemuserid%20ne%20null)&$top=50

userType field - which values are allowed?

Microsoft Graph API's User entity has field "userType". According to documentation there is no any information about this. There is one line: "A string value that can be used to classify user types in your directory, such as “Member” and “Guest”. Supports $filter.". So there is no any limitations :-)
Can be "userType" null? I can't PATCH existing user manually via graph api - graph api return an error. But on production we have some users, which have "userType": null
Which values are valid for "userType"? Can you provide it in documentation or here please?
According to your questions, I suppose you want to know the valid value of the field userType. we can refer to the content of User Entity.
For your first question, we can set the field userType to null, not " " or "null". When we create a user, the default value of this field will be Member if we didn't set it.
We can patch existing user. Based on my test, we can modify it like this:
PATCH https://graph.microsoft.com/v1.0/users/{userid}
{
"displayName": "XXX",
"givenName": "XXXX",
"jobTitle": "Marketing Director",
"userType": "Guest"
}
This will modify the user'userType from Member to Guest.
For your second question, according to the content of User Entity and the article of Azure AD User, the valid value for userType is "Member" and "Guest". Based on my test, it is sure that only these two values can be used.

Properties null when using /users but not when using /me/contacts

When getting contacts from https://graph.microsoft.com/v1.0/me/contacts I get all properties for a user, ex:
{
displayName: 'Joe Joeson',
jobTitle: 'Administrator',
department: 'HK',
mobilePhone: '09823987234',
businessPhones: '8934598743',
mail: 'joe#mail.com',
}
But when I get all users of the organization (with https://graph.microsoft.com/v1.0/users?$select=displayName,jobTitle,department,mobilePhone,businessPhones,mail,userType) the same contact doesnt get some properties, ex:
{
displayName: 'Joe Joeson',
jobTitle: null,
department: null,
mobilePhone: null,
businessPhones: null,
mail: 'joe#mail.com',
}
Why? Its the same contact? Or am I missing something? Should I get all contacts from the organization in another way?
I have confirmed that all properties are set in https://portal.azure.com
The /contacts and /users endpoints return two different entities. A contact entity represents an Outlook Contact from the current user's Exchange mailbox whereas the a user entity represents an User directory object from the tenant's Active Directory instance.
The reason you're seeing two different results is because you're returning two different entities. The first is the Joe Joeson contact from your Outlook/Exchange mailbox and the second is the Joe Joeson user from Active Directory.
The reason you're seeing less information from /users is due to your requesting the Read all users' basic profiles (aka User.ReadBasic.All) scope. This scope can only see a limited number of properties from a user resource: displayName, givenName, surname, photo, and mail.

How to structure a multi-parameter search in Falcor

What are the best practices in constructing search paths for Falcor queries?
Here an example from a Staffing domain where a staffing coordinator is trying to staff people for project needs:
A need has startDate and an endDate - both are simple string properties of the need
A need is for a project, hence it has a reference to a project
A need is for a skill, so it has a reference to a skill
Here's what a need looks like in a needMap:
needMap: {
101: {
startDate: '2016-07-04T04:00:00.000Z',
endDate: '2016-10-22T03:59:59.999Z',
project: $ref('projectMap[87]'),
skill: $ref('skillMap[3]')
},
...
}
How do I specify a search for all needs that match the following criteria:
minStartDate: minimum start date for the need
maxStartDate: maximum start date for the need
projectId: filter to needs to only this project
skillId: filter to needs to only this skill
Note: I am not looking for the code or ideas to do the actual search, only how to specify the search using Falcor path concepts.
The issues #713 and #775 from the falcor repository in github address this. Two possible solutions appear :
You can use a query string, for your case it would be something like this : model.get(["needs", "search", "minStartDate=2016&maxStartDate=2016&projectId=$ref(projectMap[87])])
You can use another endpoint for the search, and then use falcor only to get more info about the result the other endpoint returned
I guess another option would be to use a call rather than a get, as this allow you to pass multiple parameters. You would have something like this:
model.call(
["model", "search"],
{
minStartDate: "2016",
maxStartDate: "2016",
projectId: $ref('projectMap[87])
},
[],
[]);

Resources