How to replace all hyperlinks using google slides api? - google-api

Referring to the Google slides api official documentation couldn't find a way to replace all links.
I found one work around: Google Slides API: replaceAllLinks?
I am able to replace text, images but not links.
Any help shall be greatly appreciated!

The hyperlink URL is represented by the link field of TextStyle.
This Link contains the field url, which refers to the URL this is pointing to. You should update this field when calling UpdateTextStyleRequest.
As an example, your request body could be something like:
{
"requests": [
{
"updateTextStyle": {
"objectId": "your_object_id",
"style": {
"link": {
"url": "your_new_url"
}
}
}
}
]
}

Related

Google Classroom How To Post Image

How can I post an image or simple text on the Google Classroom with python (with or without API)?
I've tried to see reference but didn't find anything with python.
Here you can see the documentation. You must inform path parameter courseId and body, something like that:
{
"materials": [
{
"youtubeVideo": {
"id": "w4TJmrOVas4"
}
}
],
"text": "Students: see link for my new neurohealth class."
}

How to get name/confidence individually from classify_text?

Most of the other methods in the language api, such as analyze_syntax, analyze_sentiment etc, have the ability to return the constituent elements like
sentiment.score
sentiment.magnitude
token.part_of_speech.tag
etc etc etc....
but I have not found a way to return name and confidence in isolation from classify_text. It doesn't look like it's possible but that seems weird. Am missing something? Thanks
The language.documents.classifyText method returns a ClassificationCategory object which contains name and confidence. If you only want one of the fields you can filter by categories/name or categories/confidence. As an example I executed:
POST https://language.googleapis.com/v1/documents:classifyText?fields=categories%2Fname&key={YOUR_API_KEY}
{
"document": {
"content": "this is a test for a StackOverflow question. I get an error because I need more words in the document and I don't know what else to say",
"type": "PLAIN_TEXT"
}
}
Which returns:
{
"categories": [
{
"name": "/Science/Computer Science"
},
{
"name": "/Computers & Electronics/Programming"
},
{
"name": "/Jobs & Education"
}
]
}
Direct link to API explorer for interactive testing of my example (change content, filters, etc.)

Gatsby and GraphQL - How to Filter Array Within Query

I started using Gatsby along with GraphQL to return a query that lists all galleries that are part of a specific category. In this example the category is called "Lifestyle". This all works successfully and I get an array with all of the Galleries in the category. I also need to sort this array based off a sub field called "date". Is that possible to do via the GraphQL query itself? I tried adding (sort: { fields: [date], order: DESC }) to the gallery field but that didn't work.
Any thoughts on how to achieve this or is this as close as GraphQL can get me to what I need?
Thanks in advance for any help. Still trying to wrap my head around GraphQL.
Ryan
Example of my current query
Could you provide a bit more details about your content model?
If you use a "Reference" field in contentful, it is sadly not possible as of now with the plugin as far as I know.
If you use a "Short text, list" field, like the tags in the default example.
With the default example, you can do the following query:
{
allContentfulPost(filter:{tags:{eq:"fantasy"}}, sort:{fields:[date], order:DESC}) {
edges {
node {
title {
childMarkdownRemark {
html
}
}
slug
date
}
}
}
}
It will give you the following result:
{
"data": {
"allContentfulPost": {
"edges": [
{
"node": {
"title": {
"childMarkdownRemark": {
"html": "<p>Disney Movie</p>"
}
},
"slug": "down-the-rabbit-hole",
"date": "2017-11-26"
}
},
{
"node": {
"title": {
"childMarkdownRemark": {
"html": "<p>Old book</p>"
}
},
"slug": "down-the-rabbit-hole-2",
"date": "1865-11-26"
}
}
]
}
}
}
I came across this same issue as I was trying to sort posts from a category tag that I was using in Contentful. Like #chmac said, you can sort the data from GraphQL with Javascript.
I had to search for a good example, but I finally found one in this Gatsby starter:
Github: https://github.com/ryanwiemer/gatsby-starter-gcn/blob/master/src/templates/tag.js
Live Example: https://gcn.netlify.com/tag/fancy/
You can see in the source file that they sorted the data in a new constant called posts using moment (https://www.npmjs.com/package/moment) and lodash. In my personal example I had to tweak my constant like so:
const courses = orderBy(
this.props.data.contentfulCategory.course,
// eslint-disable-next-line
[object => new moment(object.createdAt)],
['desc']
)
Then I just used a map function like so in the component return:
{/* Courses */}
{courses.map(course => (
<div className="hero__profile" key={course.id}>
<h2>{course.title}</h2>
</div>
))}
I hope this helps!

Add online meeting url to event with Microsoft Graph API

Could anybody help me with creating an event with Microsoft Graph API.
Desirable behavior is to add a link to the event which is clickable in majority of the calendar clients.
Here is an example of the event payload I’ve used:
{
...
"body": {
"ContentType": "HTML",
"Content": "Start Online Meeting"
},
"onlineMeetingUrl": "https://somelink.com"
}
This payload is sent as POST request to https://graph.microsoft.com/v1.0/me/events
current response is:
{
...
'onlineMeetingUrl': null,
...
}
and details of the event are not clickable in the calendar app
and displayed like plain text
Start Online Meeting
or is converted to
Start Online Meeting <https://somelink.com>
in Google calendar
Thanks for help!
Can you try escaping double quotes character in value of Content property and wrap the anchor tag in div element? Example below:
{
"body": {
"ContentType": "HTML",
"Content": "<div>bing</div>"
}
}

What services can I use to fetch an image of a person based on their email address, without authentication

I know gravatar allows this, and I'd like to look into facebook, google plus, twitter, instagram, and anything else.
Do you guys know of any services like this?
EDIT: to clarify, by "without authentication" do I mean user authentication, I expect to use some sort of API
One possible approach, using Facebook Graph Api would be to perform a search against the name for users objects and also retrieve their pictures, using API version 2.2 it would be a call like:
GET graph.facebook.com
/search?q=miles davis&type=user&fields=id,name,picture
This would retrieve id, name and picture object for a search on miles davis, first results as example:
{
"data": [
{
"id": "805353876185303",
"name": "Miles Davis",
"picture": {
"data": {
"is_silhouette": true,
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfp1/v/t1.0-1/c15.0.50.50/p50x50/10354686_10150004552801856_220367501106153455_n.jpg?oh=XXXXXXXXXXXXXXXX&oe=XXXXXX&__gda__=XXXXXXX_XXXXXXXXXXXXX"
}
}
},
{
"id": "1572370603017419",
"name": "Miles Davis",
"picture": {
"data": {
"is_silhouette": false,
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xap1/v/t1.0-1/p50x50/1501761_1382020035385811_1384168153_n.jpg?oh=XXXXXXXXX&oe=XXXXXXXXXXX&__gda__=XXXXXX_XXXXXX"
}
}
}, ...........
The field is_silhouette is false if the user has a profile picure.

Resources