Simple request using googleapis to freebase - request

I would like to query freebase, to get some basic information about a celebrity.
For example, I would like to get the place of birth, and the gender of Madonna.
I achieved to get Madonna's friends by using:
https://www.googleapis.com/freebase/v1/mqlread?&query={"id":"/en/madonna","name":null,"type":"/base/popstra/celebrity","/base/popstra/celebrity/friendship":[{"participant":[]}]}
But, I'm understanding this request pretty badly. How can I change it to get the information I talked above ?
I was thinking about :
https://www.googleapis.com/freebase/v1/mqlread?&query={"id":"/en/madonna","name":null,"type":"/base/popstra/celebrity","/base/popstra/celebrity/gender":[{"gender":}], "/base/popstra/celebrity/place_of_birth":[{"place of birth":}]}
but it's not working ofc.

Here is how you build MQL queries for Freebase topics:
Find a sample topic that meets you query (ex. Madonna)
Go the the Query Editor and build a simple query for the ID of that topic:
[{
"id": "/en/madonna",
"name": null
}]​
Go to the sample topic page, click on "Edit this topic" and find the facts that you want to query for (ex. Date of birth)
You can see that Date of birth is part of the Person (/people/person) type.
Click on little wrench icon to the right of Person to go to the schema page for that type.
From there, you can see that the property that stores the date of birth is called /people/person/date_of_birth.
Add the properties that you want to your query like so:
[{
"id" "/en/madonna",
"name": null,
"/people/person/date_of_birth": null,
"/people/person/gender": null
}]​
Queries can also specify a default type (ex. /people/person) which makes the property paths shorter:
[{
"id" "/en/madonna",
"name": null,
"type": "/people/person",
"date_of_birth": null,
"gender": null
}]​
But each level of query can only have one default type so if you want to mix in properties from other types you'll need to use the full property IDs:
[{
"id": "/en/madonna",
"name": null,
"type": "/people/person",
"date_of_birth": null,
"gender": null,
"/base/popstra/celebrity/friendship": [{
"participant": []
}]
}]​
When you've got your query working in the query editor, just click the "Link" menu at the top right to get the MQLRead Link that will make that query to our API.

Related

How to write an odata time period filter in a logic app to access Outlook Calendar events?

I would like to get events that start today out of an Outlook calendar. I don't know how to translate the format of the queries used in the API calls into that which the Logic app expects.
I've tried things like
'start' ge '2020-03-19-T07:33:33.707Z' and 'start' le '2020-03-26T07:33:33.707Z' which I basically made up
a number of variations based on this answer.
and this answer was too early to support odata queries
The data is a list of objects that look like this, according to the logic app's post-run viewer:
{
"subject": "Working elsewhere (Not in the office)",
"start": "2020-03-18T21:00:00.0000000",
"end": "2020-03-18T21:00:00.0000000",
"body": "plenty of writing",
"isHtml": true,
"responseType": "notResponded",
"responseTime": "0001-01-01T00:00:00+00:00",
"id": "AAMkAGJkMGY5MTQzLWVhNDAzzAAAHYoGQAAA=",
"createdDateTime": "2020-03-19T02:44:49.558788+00:00",
"lastModifiedDateTime": "2020-03-19T02:44:49.7419829+00:00",
"organizer": "Clazbo#bvn.com.au",
"timeZone": "UTC",
"seriesMasterId": null,
"categories": [],
"webLink": "https://outlook.office365.com/owa/?itemid=AAxxD&exvsurl=1&path=/calendar/item",
"requiredAttendees": "clazbo#bvn.com.au;",
"optionalAttendees": "wherebot#bvn.com.au;",
"resourceAttendees": "",
"location": "",
"importance": "low",
"isAllDay": false,
"recurrence": "none",
"recurrenceEnd": null,
"numberOfOccurences": null,
"reminderMinutesBeforeStart": 960,
"isReminderOn": true,
"showAs": "free",
"responseRequested": false
},
There are two linked parts to this question:
How do I structure the query? What's its syntax?
How do I keep the date window rolling (I assume that it's something like start ge formatDateTime(utcnow(),'yyyy-MM-dd') and start le formatDateTime(utcnow() + 1,'yyyy-MM-dd'))
You can just use the filter query as below to do this operaion:
Start/DateTime ge '2020-03-01T08:00' and Start/DateTime le '2020-03-25T08:00'
Of if you don't want the time, it's ok if use the query below:
Start/DateTime ge '2020-03-01' and Start/DateTime le '2020-03-25'
If you want to use utcnow() in logic app, please refer to the screenshot below:
The two expressions of formatDateTime() in the screenshot are:
formatDateTime(utcnow(),'yyyy-MM-dd')
formatDateTime(adddays(utcnow(), 7),'yyyy-MM-dd')
Please pay attention to the symbol ' before and after the formatDateTime() expression in screenshot.
Hope it helps~

How to get Resource Group name from within Logic App

In an Azure Logic App, how can I get the name of the Resource Group containing the current logic app?
I want to include some tracking details in the JSON output that I am sending to another system.
I can get the run Identifier ( using #{workflow()['run']['name']} ),
and the current logic app name ( using #{workflow()['name']} )
However, I cant work out how to get the name of the resource group to which the logic app is deployed.
As a last resort, I will use the resource group name used by the deployment template, but that will be wrong if the logic app is moved later.
I could also use tags, but again that could get out of step if the logic app is moved.
Thanks
A simple formula may be:
split(workflow().id, "/")[4]
If you're deploying the Logic Apps using ARM templates (e.g. edit in Visual Studio, check into Azure DevOps git repo and deploy using release pipeline), you can create an ARM parameter:
"resGroup_ARM": {
"type": "string",
"defaultValue": "[resourceGroup().name]",
"metadata": {
"description": "Resouce group name"
}
}
Then, you can create a workflow parameter:
"resGroup_LA": {
"type": "string",
"defaultValue": "ResGroup LA default"
}
... and give it a value in the parameters initialisation section:
"resGroup_LA": {
"value": "[parameters('resGroup_ARM')]"
}
You can get all the other properties of resourceGroup() in a similar manner, see: https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-resource?tabs=json#resourcegroup
First we can create a "Initialize variable" action to get all of the data in workflow, shown as below screenshot:
Then we can find the data in workflow is:
{
"id": "/subscriptions/*****/resourceGroups/huryTest/providers/Microsoft.Logic/workflows/hurylogicblob",
"name": "hurylogicblob",
"type": "Microsoft.Logic/workflows",
"location": "eastus",
"tags": {},
"run": {
"id": "/subscriptions/*****/resourceGroups/huryTest/providers/Microsoft.Logic/workflows/hurylogicblob/runs/*****",
"name": "*****",
"type": "Microsoft.Logic/workflows/runs"
}
}
It contains the resource group name, so we just need to get the property "id" and substring it to get resource group name. The length of "resourceGroups/" is 15, so in the expression below I use add(,15) and sub(,15).
You can use the expression as below:
substring(workflow()['id'],add(indexOf(workflow()['id'],'resourceGroups/'),15),sub(sub(indexOf(workflow()['id'],'/providers'),indexOf(workflow()['id'],'resourceGroups/')),15))
At last, I got the resource group name of the logic app:

Delta query for group properties not accurate for classification changes

We enforce base controls to Office 365 groups that are dependent on the data classification value. We have two ways these controls get applied:
Through a Graph subscription which automatically applies a set of base controls to an Office 365 group
A full scan to ensure each Office 365 group with a data classification value is assigned the correct base controls
We are trying to make the 1st option execute more efficiently by only proceeding with checking/applying the base controls if the data classification property changes. The delta query for group appears to be bugged; if the classification property changed values, it does not correctly report this. Any property that has been changed has a "null" value. Also the visibility property is always there.
Repro steps:
1: Initialization. Get delta token.
HTTP GET https://graph.microsoft.com/beta/groups/delta&$deltatoken=latest
2: Make a classification change to an Office 365 group. Make a description change to another Office 365 group.
3: Delta Query.
HTTP GET https://graph.microsoft.com/beta/groups/delta?$deltatoken=DeltaToken
Prefer:return=minimal
Response is:
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#groups",
"#odata.deltaLink": "https://graph.microsoft.com/beta/groups/delta?$deltatoken=NextDeltaToken",
"value": [
{
"classification": null,
"description": null,
"visibility": null,
"id": "Group1ID"
},
{
"description": null,
"visibility": null,
"id": "Group2ID"
}
]
}
Edit: Forgot to add... Microsoft docs mention a null value means the value is empty or the property has not changed. This observation doesn't reflect the docs.

how to use merge fields in custom text tab in docusign api?

i am trying to merge Account object fields in Salesforce with text tabs of Docusign, created using WSDL class using REST api .
However im not able to merge these tabs to my salesforce account field.
"textTabs":[{
"customTabId": "2",
"documentId": "1",
"maxLength": "20",
"pageNumber": "1",
"recipientId": "1",
"templateLocked": false,
"mergeField": {
"configurationType":"salesforce",
"path":"Account.name",
"writeback":"true",
"allowSenderToEdit":"true"
}
}]
i want the recipient to fill the details in the tab and the value to be populated to salesforce fields.
please help me with the merge field code
thanks

Creating context for JSON-LD

As a simple exercise I wanted to take some test-data from a little app I had which produced a user record in JSON and turn it into JSON-LD, testing on JSON-LD.org's playground gives some help, but I don't know if I'm doing it right.
The original is:
[
{
"Id": 1
"Username": "Dave",
"Colour":"green“
}
]
So I have a person, who has a username, an ID and an associated colour.
What I've got so far is:
{
"#context": {
"name": "http://schema.org/name",
"Colour": {
"#id": "http://dbpedia.org/ontology/Colour",
"#type": "http://schema.org/Text",
"#language": "en"
}
},
"#type": "http://schema.org/Person",
"#Id": "http://example.com/player/1",
"sameAs" : "https://www.facebook.com/DaveAlger",
"Id": 1,
"name": "David Alger",
"Username": "Dave",
"Colour": "green"
}
So I'm declaring it's a #type of person, and given a URI #id.
I'm also using the "sameAs" idea, which I saw on a blog-post once, but am unclear if it is just supported right off.
Then I've tried to create a #context. Here that I've added a name and given that a reference. I've tried to create something for "colour" too. I'm not sure if pointing to a DBpedia reference about "colour" and specifying a #type and #language is good, or not.
I suppose the final thing is "username", but that feels so deeply internal to a site that it doesn't make sense to "Link" it at all.
I'm aware this data is perhaps not even worth linking, this is very much a learning exercise for me.
I don’t think that http://dbpedia.org/ontology/Colour should be used like that. It’s a class, not a property. The property that has http://dbpedia.org/ontology/Colour as range is http://dbpedia.org/ontology/colour. (That said, I’m not sure if your really intend that the person should have a colour, instead of something related to this person.)
If you want to provide the language of the colour strings, you should not specify the datatype, #language is sufficient (if a value is typed, it can’t have a language anymore; by using #language, it’s implied that the value is a string).
You are using #Id for specifying the node’s URI, but it must be #id.
The properties sameAs, Id and Username are not defined in your #context.
If you intend to use Schema.org’s sameAs property, you could define it similar to what you did with name, but you should specify that the value is a URI:
"sameAs": {
"#id": "http://schema.org/sameAs",
"#type": "#id"
},
For Username, you could use FOAF’s nick property, or maybe Schema.org’s alternateName property.
No idea which property you could use for Id (depends on your case if this is useful for others at all, or if this is only relevant for your internal system).

Resources