OneNote API Get Notebooks issue - json

The following is a sample schema from the OneNote API documentation at this site and will can be used with json2csharp.com with no problems.
http://dev.onenote.com/docs#/reference/get-notebooks.
{
"createdBy": "user name",
"createdTime": "2013-10-05T10:57:00.683Z",
"id": "notebook ID",
"isDefault": false,
"isShared": false,
"lastModifiedBy": "user name",
"lastModifiedTime": "2014-01-28T18:49:00.47Z",
"links": {
"oneNoteClientUrl": {
"href": "onenote:https://{client URL}"
},
"oneNoteWebUrl": {
"href": "https://{web URL}"
}
},
"name": "notebook name",
"sectionGroupsUrl": "https://www.onenote.com/api/v1.0/notebooks/{notebook ID}/sectionGroups",
"sectionsUrl": "https://www.onenote.com/api/v1.0/notebooks/{notebook ID}/sections",
"self": "https://www.onenote.com/api/v1.0/notebooks/{notebook ID}",
"userRole": "Contributor"
}
However, using the following Get Notebooks link has a different schema that doe
sn't pass json2csharp. Parsing your JSON didn't work. Please make sure it's valid.
"https://graph.microsoft.com/v1.0/me/onenote/notebooks"
createdBy and lastmodifiedBy are thrown as exceptions.
The sample from the apigee.com/console app uses the https://www.onenote.com/api/v1.0/me/notes/notebooks link and has the correct schema.
How do I resolve this discrepancy? Or am I mistaken?

The response payload returned from the Microsoft Graph API is slightly different from the response payload returned from the OneNote API directly.
Here's a reference to the notebook properties returned from Microsoft Graph: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/notebook
And this is what gets returned from the OneNote API directly:
https://msdn.microsoft.com/en-us/library/office/dn769050.aspx => Response properties

Related

Retrieving "Description" or "Custom Attribute" fields using Autodesk Forge API

We are trying to retrieve the description or custom attribute field as shown in BIM360 Docs using Autodesk Forge API requests/commands.
We have tried the following requests to retrieve information about a specific file:
https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-items-item_id-GET/
https://forge.autodesk.com/en/docs/data/v2/reference/http/ListItems/
We get a lot of information/data about our files, but we cannot see the Description field neither a Custom Attribute in the responses that we are getting.
"data": {
"type": "versions",
"id": "urn:adsk.wipprod:fs.file:vf.WKuhlYuyR8uK2WT8HE1bCQ?version=20",
"attributes": {
"name": "TESTING",
"displayName": "TESTING",
"createTime": "2019-07-29T09:37:33.0000000Z",
"createUserId": "*****",
"createUserName": "TESTING",
"lastModifiedTime": "2019-08-05T08:27:10.0000000Z",
"lastModifiedUserId": "*****",
"lastModifiedUserName": "TESTING",
"versionNumber": 20,
"storageSize": 27020,
"fileType": "xlsx",
"extension": {
"type": "versions:autodesk.bim360:File",
"version": "1.0",
"schema": {
"href": "https://developer.api.autodesk.com/schema/v1/versions/versions:autodesk.bim360:File-1.0"
},
"data": {
"processState": "PROCESSING_COMPLETE",
"extractionState": "UNSUPPORTED",
"splittingState": "NOT_SPLIT",
"revisionDisplayLabel": "20",
"sourceFileName": "TESTING"
}
}
},
...
}
Among all of these fields, we expected the fields "Description" or "Custom Attributes" to appear as well (As they are shown in BIM360 DOCS). ¿Is it possible to retrive these fields using API requests?
At the moment it is not possible to retrieve Custom Attribute information from BIM 360 Docs, But a new API is under development and in Private Beta testing at the moment to get this information back, Please check back with us in a near future since this will become available soon. Thank you for understanding.

How do we post messages to event grid topics?

I have created event grid topic in azure using event schema = "Event Grid Schema".
The next steps for me is trying to send messages to that event grid topic so the subscribers can do something when the message has been successfully received in event grid topic.
However, I had a problem when sending the message to event grid topic. It always reject my JSON request with error "Required property 'subject' was not set. even tough, I have explicitly set the subject in my JSON post body.
I have also add 'aeg-sas-key' value in header for authentication purposes.
Here is an example of my JSON format:
{
"id": "19291",
"subject": "myapp/vehicles/motorcycles",
"topic": "VehicleData",
"eventType": "statusupdated",
"eventTime": "2019-05-12T18:41:00.9584103Z",
"data":{
"firstName": "Jason",
"postalAddress": "xyz"
},
"dataVersion": "1.0",
"metadataVersion": "string"
}
and Here is the output:
{
"error": {
"code": "BadRequest",
"message": "Required property 'subject' was not set. Report '433759ee-6570-466e-ae12-a6dc5fccbfe1:5/14/2019 4:01:32 AM (UTC)' to our forums for assistance or raise a support ticket.",
"details": [
{
"code": "InputJsonInvalid",
"message": "Required property 'subject' was not set. Report '433759ee-6570-466e-ae12-a6dc5fccbfe1:5/14/2019 4:01:32 AM (UTC)' to our forums for assistance or raise a support ticket."
}
]
}
}
Any idea why it always ask for subject even tough I have provided the subject in my JSON?
Based on the docs:
Post to custom topic for Azure Event Grid
Azure Event Grid event schema
use the following payload:
[
{
"id": "19291",
"subject": "myapp/vehicles/motorcycles",
"topic": null,
"eventType": "statusupdated",
"eventTime": "2019-05-12T18:41:00.9584103Z",
"data": {
"firstName": "Jason",
"postalAddress": "xyz"
},
"dataVersion": "1.0",
"metadataVersion": null
}
]
If you created the topic using the Azure Portal, did you somewhere specify the inputSchemaMapping?
According to the specifications here: https://learn.microsoft.com/en-us/rest/api/eventgrid/topics/createorupdate
You need to specify a inputSchemaMapping when opting for the CustomEventSchema.

How to Move/Rename a file in TFS Source Control 2015, using the REST API?

I am trying to move files on our internal TFS using Python and the TFS REST API; the server appears to only support the API up-to version 2, but on MSDN I cannot find any docs for versions below v4.1.
The URL I'm posting to is https://<server>/tfs/<Collection>/<Project>/_apis/tfvc/changesets
Currently my best guess at the correct JSON body for the post request looks like this:
{
"comment": "moved file",
"changes": [{
"changeType": "rename",
"item": {
"path": "<filepath>",
"version": 468,
"sourceServerItem": "<filepath>"
}
}]
}
But i cannot get further than an HTTp error 400 bad request with the following message
{
"$id": "1",
"innerException": null,
"message": "Exactly one value for PathActions is required.\r\nParameter name: change.SourceServerItem",
"typeName": "System.ArgumentException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"typeKey": "ArgumentException",
"errorCode": 0,
"eventId": 0
}
And for the life of me i cannot find any reference to PathActions on google, that is not for git instead of tfvc, or a correct way of providing a value for this item.
Does anybody have a way of renaming/moving files on a TFVC via a HTTP request?
It just occurred to me to do a rename using the TFS web interface and peek at the request sent by the browser.
Turns out this is the correct format:
{
"comment": "Moved File",
"changes": [
{
"changeType": 8,
"sourceServerItem": "<old path>",
"item": {
"path": "<new path>",
"version": 470
}
}
]
}

Is there any data returned from the Forge Data Management Search api to indicate a model is deleted?

When using GET projects/:project_id/folders/:folder_id/search, Forge Data Management API on a model with a deleted last version, is there a any information in the "attributes" or other returned data that indicates the file is deleted?
Currently, a second call to GET projects/:project_id/items/:item_id/versions is used to determine if the latest version is deleted (below) but it would be preferable to not call another request to get this information.
Returned JSON from /versions (with some data removed):
"data": [{
"type": "versions",
"id": "urn:adsk.wipprod:fs.file:vf.w0cwXPUwQziKIHtKBtYRaA?version=3",
"attributes": {
"versionNumber": 3,
"extension": {
"type": "versions:autodesk.core:Deleted",
"version": "1.0",
"schema": {
"href": "https://developer.api.autodesk.com/schema/v1/versions/versions:autodesk.core:Deleted-1.0"
},
"data": {
"originalName": "**.rvt"
}
}
}]
The json attribute.hidden = true seems to indicate deleted. This can be accessed via the filter[hidden] = true. I'm closing this as the correct answer.

Graph API: Check if feed post was made by a Page or User

When using the /page/feed endpoint in the Facebook Graph API I can't figure out how to know if the post was made by a Page or a User
Here's how I call the endpoint right now:
HTTP GET https://graph.facebook.com/v2.8/{page_id}/feed?fields=is_published,from,message
This yields the following JSON response:
{
"data": [
{
"from": {
"name": "Chad Smith", # <-- This is a User
"id": "806273209398023"
},
"message": "A really magical place! Best Christmas...",
"id": "103988597020_1445496708809010"
},
{
"from": {
"name": "Tivoli", # <-- This is a Page
"id": "103988597020"
},
"message": "Hello everybody...",
"id": "103988597020_10154040865527021"
},
]
}
How can I know if the post was from a Page or User without making additional API calls? I've tried using subfields, but can't figure out if they work on the from field.
I solved it by using ?fields=from{name,about} and marking it as a Page if the from JSON contains about.
This is not the best solution, but about is currently the only subfield of from that doesn't fail on User. (e.g. if I was using ?fields=from{fan_count} the Graph API will fail for posts made by User objects.