is there a way to query the Microsoft Graph API to get same information like those in a report, e.g. getSkypeForBusinessDeviceUsageDistributionUserCounts?
Report: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/reportroot_getskypeforbusinessdeviceusagedistributionusercounts
Reason: Reports return csv files. I would like to directly the data as JSON .
Thanks!
Microsoft Graph currently only supports return Reports as a CSV file. It is possible to retrieve it in another format (i.e. JSON or XML).
There is a similar request for JSON responses in the Office Developers UserVoice.
Related
I'm trying to make search request for my OneDrive files with some specific extensions. Only solution I've got right now is to filter out after received response but that's not what I'm looking for.
Query I tried:
https://graph.microsoft.com/v1.0/me/drive/root/search(q='book filetype:xlsx OR filetype:xls OR filetype:svg OR filetype:json OR filetype:txt')
Unfortunately it's not returning anything.
AFAIK, the search endpoint will search the keyword like 'book' with all the extensions and give the driveItem objects as response. You need to filter it on your end which extension you like to pick by writing the code. Please raise a feature request in Microsoft Graph Feedback Forum so that the Product team may implement it in future.
I need to search for files with .docx extension in my OneDrive. So this bit is simple and it works using OneDrive search api. The piece that does not work, is that in the response, with each DriveItem, I also need the custom properties we created under ListItem.Fields associated with this DriveItem. These custom properties contain information I need to create some sort of a report.
Expanding ListItem seems to work on root/children resource without any search, but it does not solve my problem, I need the files with the .docx extension in their filenames, these files can be under root or any sub folder under the root.
So this request returns the CustomProperty with the response
/_api/v2.0/drives/[drive id]/root/children?select=*%2cwebDavUrl
%2csharepointIds&expand=listItem(select%3dfields%3bexpand%3dfields(select%3dCustomProperty))
But when I try to expand ListItem on the DriveItems returned from search query as below:
/_api/v2.0/drives/[drive id]/root/search(q='docx')?select=*%2cwebDavUrl%2csharepointIds&expand=listItem(select%3dfields%3bexpand%3dfields(select%3dCustomProperty))
I get an error:
Error: {"error":{"code":"notSupported","message":"The request is not supported by the system."}}
Is expanding ListItem.Fields on a DriveItem not supported in OneDrive Search api ?
If it is not, then is there another way for me to achieve what I want to do here? I am not trying to search on the CustomProperty, just want to retrieve that value as part of the response with its associated DriveItem.
Expectedly, I get same/similar error if I run this through Microsoft Graph Search api instead of OneDrive api.
One workaround I could do,
is to first search for .docx files without the expand keyword and it will recursively search and return all .docx files in my OneDrive. Then I could make individual calls to request these items again one by one from OneDrive using their DriveItem.Id and the expanded ListItem.Fields property. That would be a terrible workaround though. Because instead of achieving what I need in a single request, I would have to make 1000s or 10000s of individual I/O requests (one per .docx file) to get the expanded ListItem properties..
This is a known issue with the /search endpoint. Unfortunately, there isn't a good workaround available at the moment either. In order to retrieve the ListItem resources, you will need to retrieve each DriveItem from your search result directly:
/drives/{drive-id}/items/{item-id}?$expand=listItem
I'm having some issues using a custom connector to get what I want out of the Microsoft Graph. Essentially, what I am looking to do is take the Email Activity User Detail report and turn it into a Power BI report.
The URL for that report is as follows:
/v1.0/reports/getEmailActivityUserDetail(period='D7')
In order to create this custom connector, I have been using the MyGraph Connector Sample as I'm not very familiar with the use of Power Query, nor the Graph API.
I have created the connector and can connect to the API and everything, but rather than return me the data, all the query does it return me a byte array I can't seem to do anything with.
From looking at Fiddler traces, the actual data I want is being picked up along the way, but it looks like the Graph API uses a redirect URL to the download, which I'm not sure my Power Query code is handling. I think it may just be returning the redirect URL as a string rather than the actual data.
Further to this, my query has no code to handle the NextLink if it goes over the number of returned rows (I think 200?), so I imagine it will not return the full dataset once I do get it working. How is this best handled?
Unfortunately, I am very new to Power Query (this is my first encounter with it, in fact), so I'm not sure where to begin to make the necessary changes to get what I need.
Any assistance would be greatly appreciated.
The Microsoft Graph API - GET Reports in Graph Explorer and Power BI question touches on a similar issue, though that is through the Application interface itself, which seems to be unable to get the necessary authorization tokens by itself.
EDIT: I have managed to fix the issue thanks to the advice from Marc LaFleur.
The problem was indeed that I was trying to use the Odata.Feed as the source. Changing the line:
source = OData.Feed("https://graph.microsoft.com/v1.0/me/", null, [ ODataVersion = 4, MoreColumns = true ])
To:
source = Csv.Document(Web.Contents("https://graph.microsoft.com/v1.0/reports/getEmailActivityUserDetail(period='D7')"))
Fixed the issue and returned the correct values with no other changes.
Microsoft Graph's Reports are not traditional REST endpoints. Rather than returning OData/JSON, they return a temporary URL to a physical file in CSV format.
From the documentation:
If successful, this method returns a 302 Found response that redirects to a preauthenticated download URL for the report. That URL can be found in the Location header in the response.
From the example you linked too, it looks like it is expecting an OData.Feed source (source = OData.Feed). In this case, you're not getting an OData result but rather a URL to a CSV file. I believe you're looking for Csv.Document instead.
I have been using Ms Graph API, to download the files of OneDrive successfully.
I was looking for a way to read only the text content (for indexing purpose in my application) using Graph API, for different types of files(pdf,xls,zip,Images etc.) instead of going by the conventional approach of downloading the complete file and then extracting the text using some "Text extracting api" and then index the file, which would be a time consuming task. I am aware GraphAPI has its own search features, but it lacks ability to do complicated search like regular expression search (please correct me if I am wrong). I am sure OneDrive does its own indexing for each file which helps a user to do the basic search.
So, is there any way I can get the text content of the documents using the Graph API?
I don't believe getting a 'preview' of text-based documents is currently available through the API. You will need to make a GET request to fetch the content. If you don't want the full document, you can request a partial range of bytes that you believe would be enough for the document. In addition, to make it easier to handle different file types, we currently support converting common file formats to PDF (to possibly standardize your file parsing logic).
I am planning to do a survey using survey monkey. I will require API support to automatically pull responses from your datasource. I looked into https://developer.surveymonkey.com/docs/methods/get_responses/ and it looks like I need to use services like curl to extract data. It also looks like I can extract data in json format. And the data that is extracted using get_responses api, returns only ids.
So my questions are:
1. Do you support REST APIs to download data?
2. Can I download data in csv format?
3. Can I download actual responses with questions and not just ids? What APIs will be return survey, questions asked and user responses?
3. Can you send me an example format of how data will look when downloaded using the APIs?
5. Finally, with $26/month subscription for one month, will I get API support? Is the API support available for free subscription?
Thanks!!
SurveyMonkey does have a REST API
You can get all responses (just ids) doing:
GET /surveys/{survey_id}/responses
See: https://developer.surveymonkey.com/api/v3/#surveys-id-responses
You can get the details and all answers to questions for a specific response by ID doing:
GET /responses/{response_id}/details
See: https://developer.surveymonkey.com/api/v3/#responses-id
Or you can do this all at once by doing
GET /surveys/{id}/responses/bulk
See: https://developer.surveymonkey.com/api/v3/#surveys-id-responses-bulk
Answered by akand074.
We only support JSON at this time.
You'll have to make a separate GET to /v3/surveys/{survey_id}/details to get the survey details, and then map it to the response data.
The format, along with response data examples can be found here.
You'll have to contact api-support#surveymonkey.com to find out.