Google Classroom API References doesn't ask for Description Heading - google-classroom

I am creating a google classroom using API's. There is a field called Description heading in the Google classroom API reference, but when I create a classroom, it doesn't ask for a Description heading.
Where can I find and change the value of the Description heading?

You can try to use Method: courses.create then you can add from the request body sample:
Request body:
{
id:
name:
room:
section:
description:
descriptionHeading: // add the description heading here
}
descriptionHeading string
Optional heading for the description. For example, "Welcome to 10th
Grade Biology." If set, this field must be a valid UTF-8 string and no
longer than 3600 characters.

Related

Post data to custom AL field in Business Central

I am trying to create an API call to add data into a custom field that was created on the Sales Order page using AL Extensions. The issue is when I try to do the api call through postman, I am getting "The Property "propertyName" does not exist on type 'Microsoft.NAV.salesOrder'". First of all, I don't even know if the API allows for this, so is it even possible? And secondly, if it is possible, is there a certain way to set up the API call or the Field through the AL Extension?
tableextension 50100 "AddProjectIdToSalesOrder" extends "Sales Header"
{
fields
{
field(50100; "CrmProjectId"; Guid)
{
Caption = 'Crm Project Id';
DataClassification = OrganizationIdentifiableInformation;
}
}
}
pageextension 50100 "AddProjectIdToSalesOrder" extends "Sales Order"
{
layout
{
addlast(General)
{
field("CRM Project Id"; Rec.CrmProjectId)
{
ApplicationArea = all;
ToolTip = 'The Guid of the related Project Record in the CRM environment';
}
}
}
}
This is how I am setting up the field with the AL extension, and for the post call, I am just creating a new Sales Order with a post and the body looks like:
{
"customerNumber" : "10000",
"CrmProjectId" : "random-guid"
}
And the error is "Bad Request": "The property 'CrmProjectId' does not exist on type 'Microsoft.NAV.salesOrder'. Make sure to only use property names that are defined by the type." Any help would be appreciated.
The Sales Order API is a separate page. It is not equivalent to the Sales Order page so you have to modify the API to accomplish what you want.
However the standard API's provided by Microsoft can't be extended.
You are left with two options:
Make a copy of the standard Sales Order API (this involves making a copy of all the linked APIs as well e.g. the Sales Line API).
Create a new API page with the single purpose of updating your new field. Then you would use the standard Sales Order API to create the Sales Order and then update CrmProjectId with a second call to your custom API page.

Mailchimp (mandrill) transactional emails: how to add custom data to email templates?

I want to be able to send an email template to a customer which contains some data that is specific to the individual customer (e.g an order number, or a temporary password)
I've designed an email template which I intend to send to customers, but I'm not sure how to add this dynamic data to the template.
I'm using the API to send emails to customers, and I've learnt that you can send templates to customers with a request like so:
POST: https://mandrillapp.com/api/1.0/messages/send-template
Request Body:
{"key":"myApiKey","template_name":"test","template_content":[],"message":{"html":"","text":"","subject":"Template sending test","from_email":"someEmail","from_name":"Company Name","to":[{"email": "someOtherEmail", "type": "to"}]}}
Is it possible to add custom data such as { "orderNumber": "12345" } to the json, and if so how would the template know to render that in in the template email? I assume there must be a field you create which corresponds to the data in the post request.
I had a look at the metadata tags in the documentation, which allow you to add "custom, individualized metadata to messages" but it doesn't sound like you can add this data to an email template?
Ok.... If I had actually just continued reading the documentation it tells you how to do this!
https://mailchimp.com/developer/transactional/docs/templates-dynamic-content/#editable-content-areas
So you can add this html in your email template:
<div mc:edit="main">
Content to be replaced.
</div>
And then in my json, I can add replacement content for this area of the email in "template_content" (obviously!).
{
"key":"myApiKey",
"template_name":"test",
"template_content":[
{
"name":"main",
"content":"Hello World - content replaced"
}
],
"message":{
"html":"",
"text":"",
"subject":"Template sending test",
"from_email":"someEmail",
"from_name":"Company Name",
"to":[
{
"email":"someOtherEmail",
"type":"to"
}
]
}
}

Can an enum return description (string) in GraphQL?

I'm struggling with my GraphQL API because I need to take advantage of Enums while keeping their full description in the frontend.
In short:
I have different states for a product: "Has been sent", "Not sent yet", "Received".
So this is the right place to use Enums:
enum ProductState {
HAS_BEEN_SENT
NOT_SENT_YET
RECEIVED
}
But I need to display the proper strings on the frontend ("Has been sent", and not "HAS_BEEN_SENT").
I can't use a simple solution as "replace underscores with spaces and lowercase the string" because my API is not in English but in French (so I have accents and special characters).
Can't an Enum return a string? Or an object?
I tried with directives but impossible to get it work...
Actually I don't care how it is written in the database (the uppercase or lowercase form) nor in the GraphQL API. I just need my client to access to the different product states in their "French" form.
As far as I know there is only one supported syntax for defining enums in GRAPHQL, which is the one you are using. You cannot associate an enum with a string value.
#NOTE: I would probably use a more descriptive name as opposed to ProductState
enum AllowedProductStatus {
HAS_BEEN_SENT
NOT_SENT_YET
RECEIVED
}
However, if you use apollo server you can use resolvers to add custom values.
const resolvers = {
AllowedProductStatus: {
HAS_BEEN_SENT: "Has been sent",
NOT_SENT_YET: "Not sent yet",
RECEIVED: "Received"
}
};
Alternatively, If you simply wants to make it unique you could also use the directive #unique
type Product {
status: String! #unique
}
Hope it was helpful.

Documenting GraphQL short-hand model

How does one document the model, using GraphQL shorthand notation?
type User {
name: String
}
Say I want to add a description for the type/attribute above.
Descriptions come in the form of comments:
# Someone who uses something
type User {
# How we refer to the user
name: String
}
Those should be added as descriptions to the schema generated from this notation.

Displaying PUT body format with go-restful and swagger

I am using go-restful and swagger to generate apidocs which is working great. The problem I am facing is that when I add a body parameter to the documentation I would like to specify the DataType and its format. I can specify the DataType (i.e. UserFields), but the format of the JSON does not show in the Swagger UI, which can be very convenient.
Here is an example of what I am talking about:
The following link shows a body parameter and the corresponding JSON/model next to it http://petstore.swagger.wordnik.com/#!/store/placeOrder
In my case, the JSON/model is missing and only the DataType is displayed http://ibounce.co:8282/apidocs/#!/users/PutUserField
Here is the sample Go code is generates the documentation for this specific endpoint.
ws.Route(ws.PUT("/{id}/fields").
To(PutUserField).
Doc("Update user fields").
Operation("PutUserField").
Param(ws.HeaderParameter("Authorization", "username and password").DataType("string")).
Param(ws.PathParameter("id", "identifier of the user").DataType("int")).
Param(ws.BodyParameter("body", "identifier of the user").DataType("UserFields")).
Returns(http.StatusOK, http.StatusText(http.StatusOK), User{}).
Returns(http.StatusUnauthorized, http.StatusText(http.StatusUnauthorized), ApiError{}).
Returns(http.StatusBadRequest, http.StatusText(http.StatusBadRequest), ApiError{}))
UserFields is a struct:
type UserFields struct {
Email string `json:"email,omitempty"`
Phone string `json:"phone,omitempty"`
URL string `json:"url,omitempty"`
Address string `json:"address,omitempty"`
}
Any suggestions will be appreciated.
I figured it out. In the Go code above instead of
DataType("UserFields")
I have to use
DataType("main.UserFields")

Resources