resourceData returns null for microsoft graph API webhook for Sharepoint Online - json

I am trying to set webhook notification for SharePoint Online drive using MS Graph API. The subscription is setup. Whenever I make any change in the drive by adding/deleting a file I get a notification but the resourceData is null.
Is this standard behaviour?
{"value":[
{"subscriptionId":"XXX",
"clientState":"secretClientValue",
"tenantId":"XXX",
"resource":"drives/<id>/root",
"resourceData":null,
"changeType":"updated",
"subscriptionExpirationDateTime":"2019-01-22T18:23:45.9356913+00:00"
}
]
}
Thank you for any suggestions.

Not all resources return resourceData within the notification itself, OneDrive is one of these.
OneDrive will return the following properties:
{
"subscriptionId": "string",
"expirationDateTime": "datetime",
"resource": "relative url",
"clientState": "string optional",
"changeType": "updated"
}
You can find the spesific documentation for this entity here.

Related

Autodesk Construction Cloud API unavailable endpoints

Our team is working with Autodesk Construction Cloud and it's Docs module quite heavily. Because of that we're trying to develop some internal tools which would automate some work that they do, mostly around copying files.
In ACC Docs you can easily copy files from one folder to another. From our investigation it looks like the ACC internally uses an endpoint like this to copy the files:
https://developer.api.autodesk.com/dm/v3/projects/{{projectId}}/documents:copy?targetFolder={{targetFolder}}
By using the authentication token from ACC requests (obtained from the browser), we can easily use this call from Postman or even an AWS Lambda function. But when we're using the auth tokens obtained from 3-legged auth process as described in the documentation, the same API call fails.
Is it even possible right now to obtain an auth token which works with that endpoint for copying ACC Docs files? Or is this not available right now as this API is still not really "public"?
Happy New Year!
Those APIs are internal APIs. Please do not try to use them. even if it may work, you would use it on your own risk..
Regarding with copy files files from one folder to the other, you can use the public API. After you get the version urn of the original file, call the endpoint below with the parameter
POST https://developer.api.autodesk.com/data/v1/projects/{PROJECT_ID}/items?copyFrom=urn%3Aadsk.wipprod%3Afs.file%3Avf.rH_L4XJsTmeiYA4ixCVNAA%3Fversion%3D1
with the payload, in which specify the target folder.
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "items",
"relationships": {
"tip":{
"data":{
"type":"versions",
"id":"1"
}
},
"parent": {
"data": {
"type": "folders",
"id": "urn:adsk.wipprod:fs.folder:co.0xaYa2rVTJuFiz7rxLCOQQ"
//!<<< The folder we want to put this file
}
}
}
},
"included":[
{
"type":"versions",
"id":"1",
"attributes":{
"name":"rac_basic_sample_project.rvt" //!<<< Version name
}
}
]
}

How to prevent Google Drive API v3 from sending a notification email when giving writer permissions?

I'm able to give writer permissions using the Google Drive API (v3). This is the endpoint:
POST https://www.googleapis.com/drive/v3/files/FILE_ID/permissions"
The API reference says that I should use sendNotificationEmail: false (note, this is a boolean not a string), which is what I'm doing (in v2 this was called sendNotificationEmails).
However, after the call I still get the email from Google saying I've been invited to edit a file. 🤔
sendNotificationEmail: false works as intended, there is one small detail:
It is a request parameter that goes outside of the resource body.
I am not sure which language your are using, if e.g. Javascript, the request would be:
gapi.client.drive.permissions.create({
"fileId": "XXX",
"sendNotificationEmail": false,
"resource": {
"role": "writer",
"type": "user",
"emailAddress": "test#gmail.com"
}
})

OAuth consent screen - ability to remove application logo: old solution is no longer working

Question: how to remove an application logo.
Solution: previous solution from this answer, https://stackoverflow.com/a/57168008/1992004, is no longer working.
Google changed the format of "iconUrl" to "icon", and uses now the Base64-encoded data stream, like "icon":"iVBORw0KGgoAAAAN..., instead of the image URL, previously written as "iconUrl":"https://...".
I've tried "icon":"" and many Base64-encoded values like "icon":"IA", "icon":"Lw", and some of other - no success. I get console messages like
for "icon":""
{
"error": {
"code": 400,
"message": "The request failed because one of the field of the resource is invalid.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.PreconditionFailure",
"violations": [
{
"type": "client_auth_config",
"subject": "?error_code=9&error_field_name=UpdateIconRequest.icon&error_field_value=%3CByteString#3eeee81e+size%3D0+contents%3D%22%22%3E"
}
]
}
]
}
}
or
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.identity.clientauthconfig.v1.ClientAuthConfigError",
"code": "ICON_STORAGE_FAILURE"
},
{
"#type": "type.googleapis.com/google.identity.clientauthconfig.v1.IconStorageError",
"reason": "INVALID_IMAGE"
}
]
}
}
or
{
"error": {
"code": 400,
"message": "Invalid value at 'icon' (TYPE_BYTES), Base64 decoding failed for \" \"",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "icon",
"description": "Invalid value at 'icon' (TYPE_BYTES), Base64 decoding failed for \" \""
}
]
}
]
}
}
Does somebody know, what should be inserted here to remove the logo image from the app?
Answer:
Unfortunately, there is no way for this to be done.
More Information:
Once an OAuth Application Logo has been uploaded there isn't a supported way of removing it - in the question that you linked the way that this was done is a bit hacky, inspecting the network requests and building a new request from the previous JSON object sent via the UI really shows this.
As the icon URL has changed to need a Base-64 encoded value this has been deprecated. Whether this was intentional by Google or not is hard to say, but now an empty value will always return INVALID_ARGUMENT. Any data in the value for icon will also just replace the image data and so this isn't a viable workaround, as as far as the validation process goes, image data exists and so will need to be verified.
If it's not too much of a arduous process, the only workaround here is to create a new GCP project with a new OAuth consent screen without uploading an image. Of course, you will need to reactivate all the relevant APIs and link the relevant scripts and projects to the new set-up.
Feature Request:
You can however let Google know that this is a feature that is important and that you would like to request they implement it. Google's Issue Tracker is a place for developers to report issues and make feature requests for their development services. I would suggest using the feature request template for G Suite Add-ons as this is a component for which GCP Projects could be used.
Update: The feature request for this is viewable here, to increase visibility on this, hit the ☆ at the top of the page.
Relevant Questions:
OAuth consent screen - ability to remove application logo [Obsolete]
May 2021 - It is still possible to completely delete the consent screen (and thus allowing to create it again). See my updated answer in https://stackoverflow.com/a/57168008/1992004

ChatFuel - Google Drive - Get file content using GET method via URL

I am developing a Fuel chatbot that gets file's content from Google drive to build gallery.
I am using JSON API (Fuel chatbot) to get the JSON response.
My file in drive: https://drive.google.com/file/d/0Bx79Tkj95Q3iNmVHOFN0Q3BITE0/view
I want to get JSON response like:
{
"messages": [
{
"attachment":{
"type":"template",
"payload":{
"template_type":"generic",
"elements":[
{
"title":"Classic White T-Shirt",
"image_url":"http://petersapparel.parseapp.com/img/item100-thumb.png",
"subtitle":"Soft white cotton t-shirt is back in style",
"buttons":[
{
"type":"web_url",
"url":"https://petersapparel.parseapp.com/view_item?item_id=100",
"title":"View Item"
},
{
"type":"web_url",
"url":"https://petersapparel.parseapp.com/buy_item?item_id=100",
"title":"Buy Item"
}
]
},
{
"title":"Classic Grey T-Shirt",
"image_url":"http://petersapparel.parseapp.com/img/item101-thumb.png",
"subtitle":"Soft gray cotton t-shirt is back in style",
"buttons":[
{
"type":"web_url",
"url":"https://petersapparel.parseapp.com/view_item?item_id=101",
"title":"View Item"
},
{
"type":"web_url",
"url":"https://petersapparel.parseapp.com/buy_item?item_id=101",
"title":"Buy Item"
}
]
}
]
}
}
}
]
}
I tried to get the content of the file by URL:
https://www.googleapis.com/drive/v3/files/0Bx79Tkj95Q3iNmVHOFN0Q3BITE0/export?mimeType=application/vnd.google-apps.file
But I got the response
Do you have any suggestion to get the JSON response ?
Consider this documentation and test again.
Your error is:
403: Daily Limit Exceeded
The Courtesy API limit for your project has been reached.
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "dailyLimitExceeded",
"message": "Daily Limit Exceeded"
}
],
"code": 403,
"message": "Daily Limit Exceeded"
}
}
Suggested action: Request additional quota.
Based from the SO post, you may do the following to get rid of your error.
Create a Google APIs Console project
On the Services pane, enable all of the APIs that your project requires.
On the API Access pane, click Create an OAuth 2.0 client ID. A dialog opens. Fill in your project's information. Click
Next
Choose the appropriate application type. Based on the tags you used for this post, I am guessing this is an iOS project so select
Installed application.
Enter your bundle ID. You don't need to enter an App Store ID until your app is listed there.
Click Create Client ID.
You will see the client ID and client secret values. You will use
these values to enable communication with your project and the Google
APIs.
If you aren't already using it, see the Google+ iOS SDK and
documentation for a full walk through. The task called "write
moments" is similar in implementation and demonstrates how to connect
to and use the Google+ REST APIs from within an iOS project that uses
the SDK.
You'll need to specify the scope of plus.me to get the profile
information.
Hope this helps.

Malformed JSON response when GETting /me/memberOf (Microsoft Graph)

I'm trying to set up a sign-on process for an internal company web app using the Azure AD and Microsoft Graph. I want to manage security groups in the AD, so when a user signs in via OAuth, I'm doing a GET request to https://graph.microsoft.com/v1.0/me/memberOf to see which groups the signed-in user is in. The user has the appropriate scopes to see this information, and it works in the Graph Explorer, but when I make the call in my PHP application, I get a malformed JSON response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects",
"value": [{
"#odata.type": "#microsoft.graph.group",
"objectType": "Group",
"objectId": "blahblah2",
"deletionTimestamp": null,
"description": "Users who have access to my web app's administration",
"dirSyncEnabled": null,
"displayName": "Web App Administrators",
"lastDirSyncTime": null,
"mail": null,
"mailNickname": "blahblah2",
"mailEnabled": false,
"onPremisesSecurityIdentifier": null {
"error": {
"code": "InternalServerError",
"message": "Unsupported extension property type.",
"innerError": {
"request-id": "blahblah3",
"date": "2016-02-29T09:42:18"
}
}
}
...and that's all I get!
The documentation at https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/entity-and-complex-type-reference#GroupEntity says that this onPremisesSecurityIdentifier field is something to do with on-premesis sync, but i've never used that.
Your request had api-version query parameter appended (i.e. /v1.0/me/memberOf?api-version=1.6). Please remove that query parameter. Microsoft Graph identifies the API version by the first segment in the URL path, e.g. https://graph.microsoft.com/v1.0/me/memberOf or https://graph.microsoft.com/beta/me/memberOf