Is there a way to combine multiple powerbi api requests in to a single restapi call? Something like a batch request to get a collective response? - azure

I'm trying to reduce the api calls to fetch data out of powerbi rest api. when i call endpoint like /Groups, The response is straight forward in a single api call, I get all the groups. in order to get datasets,dashboards and reports i'll have to pass every group id to endpoints of reports,datasets.,etc.
eg.
GET https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets
Is there a way to combine these requests, such a way that i send multiple group ids in a single api call to get all the datasets from their respective groups?
I have not found a way to combine it all together to make a single batch api call.
However, I tried a different endpoint found from MSDocs to avoid input of group id.
GET https://api.powerbi.com/v1.0/myorg/datasets
But the problem with this is, the response wont have information of which group the dataset belongs to. without group information,the retrieved data wont be useful for me.
https://learn.microsoft.com/en-us/rest/api/power-bi/datasets

You must use the admin part of the API. To get a list of all groups in your organization, call GetGroupsAsAdmin (you can filter what you want to get too). Similarly, call GetDatasetsAsAdmin to get list of datasets. Look at their webUrl property to find their group.
https://api.powerbi.com/v1.0/myorg/datasets wont return all datasets (or datasets from multiple groups) but will give you the datasets located in your own My workspace.

Related

Best practice to handle patch / delete in REST API

I have a collection of Employees, on which CRUD operations can be performed.
I am working on 2 given endpoints
delete multiple employees in single API requests given the ids of the employees to be deleted is given in the body of the request.
update multiple employees using single API request.
Lets consider an example where one of the ID is not found in the list of employee ids to be deleted/deleted/updated, in this case should the whole request be rejected ? or delete the existing ones and send error response only for the not found id?
It would be helpful, if you could help me with the best practice.
Thank you,
KK

Performance tile showing different records for same method

Currently in Performance tile in Insight we have performance detail for the application request.
If we have an API like:
GET /order/{orderId}
so, for this kind of request, it showing as different request and matrix is also different for different orderId.
But for the owner point of view, this is a same request and needs to have shown under one request for all call for this method.
For the above mentioned API, if we have the request coming as:-
/order/1
/order/2
/order/3
Then in Azure portal, under performance tile for Application insight, it consider this as different operations and hence show stats individually for each unique request.
But as per the developer, this is a single API and needs to monitor as single operation.
How to achieve this in Azure portal?
In the Performance tab, you have the ability to add filters for your results but in your scenario I would:
Click on View in Logs (Analytics)
Select Requests
Add an appropriate contains statement: | where operation_Name contains "GET /order"
At this point the Overall line contains the total Duration Average and Count shown in the Performance tab, as well as percentile information for all orders.

How do i fetch only internal messages from O365 using Graph API

I wan't to fetch only messages that are only internal to organization.
Right now the way i see is fetch domains first then for each message see if from/sender domain belongs to that message , based on that differentiate.
But this is lengthy process and not a foolproof technique.
Is there any GRAPH API query i can use which readily provides this ?
It does not apear that the REST API queries for Office 365 includes this information directly in the messages. From the Version 2.0 And the Beta this is not included in message output.
However, it looks like you might be able to get it from the REST API via the headers.
Try the following query:
https://graph.microsoft.com/beta/me/messages?$select=internetMessageHeaders&$top=1
This takes top one messages and shows you the email header of the message.
In the header look for X-OriginatorOrg. The value should be the main domain of your organisation.
Alternatively you can look at the X-MS-Exchange-Organization-MessageDirectionalityheader. If the value here is Originating it should come from inside your own organisation.

Track multiple context for the same Bot

We have a bot that will be used by different customers and depending on their database, sector of activity we're gonna have different answers from the bot and inputs from users. Intents etc will be the same for now we don't plan to make a custom bot for each customer.
What would be the best way to separate data per customer within Chatbase?
I'm not sure if we should use
A new API key for each customer (Do we have a limitation then?)
Differentiate them by the platform filter (seems to not be appropriated)
Differentiate them by the version filter (same it would feel a bit weird to me)
Using Custom Event, not sure how though
Example, in Dialogflow we pass the customer name/id as a context parameter.
Thank you for your question. You listed the two workarounds I would suggest, I will detail the pros/cons:
New API Key for each customer: Could become unwieldy to have to change bots everytime you want to look at a different users' metrics. You should also create a general api (bot) where you send all messages in order to get the aggregate metrics. This would mean making two api calls per message.
Differentiate by version filter: This would be the preferred method, however it could lengthen load times for your reports as your number of users grows. The advantage would be that all of your metrics are in one place, and they will be aggregated while only having to send one api call per message.

Retrieve a mailchimp list via GET

I am trying to retrieve a MailChimp list.
I have an API Key and a List ID, and while I understand that I can use the MailChimp API wrapper to achieve this I prefer to avoid implementing it since I only need to do this one task.
When I enter in my browser:
https://us3.api.mailchimp.com/2.0/lists/members?apikey=*****&id=******
I get a JSON result of my list - but it is limited to the first 25 subscribers. I don't see anything in the MailChimp API documentation about submitting a GET request to retrieve a list. Is it possible to do so? If so, how can I retrieve a full list?
Read this: http://apidocs.mailchimp.com/api/2.0/lists/members.php
Options are available via pagination.
You are supposed to POST the values in your request.
Looks like the best method is to use the MailChimp list method which "Exports/dumps members of a list and all of their associated details. This is a very similar to exporting via the web interface."
Read more at http://apidocs.mailchimp.com/export/1.0/list.func.php
Another option is to use API v1.3 listMembers function, more info here: http://apidocs.mailchimp.com/api/1.3/listmembers.func.php. v1.3 is deprecated, but it still functions properly.

Resources