Microsoft Graph API transient user filter - azure

Is there a way for me to get back ONLY users when I call List group transitive users in graph API?
The response I get has objects for groups as well as users EG:
{group: IT support},
{user: Kevin},
{user: Bob},
{user: Phil},
{group: Developers},
{user:phil}
Id like to be able to filter out the group objects but no dice. Has anyone been able to do this before? Thanks

Usually, we can use $filter query parameter to retrieve the response we need, but it seems that '#odata.type' is not supported to be a query param here. I will double confirm with Azure support engineer.
By the way, the response is in json format, you can write a filter yourself to get the user objects only.
Update:
I have got an response from the Azure support engineer, '#odata.type' is not supported to be a query param here. So you need to deal with the data by yourself.

Related

How to pass a document's ID using Azure CosmoDB?

I am creating a simple CRUD app to learn Azure. I have created a logic app (standard model) and my APIs are designed using the workflow designer. I also have a CosmoDB to hold each object.
My GET API, that gets all the documents, looks like this:
And my GET API, that gets only one document, looks like this:
Here is what my CosmosDB looks like with the ID of the item that is successfully return when statically called:
So what do I need to replace the static ID with, in the *Document ID input so that I can pass in different IDs?
I have looked at the docs and it suggests documentId, but when I type this in I get this error:
Thanks!
Thank you #404 , posting your suggestion as an answer to help other community members.
" You should know the id you want to retrieve from the flow that feeds into the Get a document block (unless it's static). Since you only have a HTTP trigger your id should be supplied through that. As example by passing the id in the url as query parameter which you then refer to in your Document ID field."
Trigger a post request to logic app with Document ID in request body.
Try as below:

What does it mean "Another object with the same value for property proxyAddresses already exists" during licensing an user in Azure AD?

I'm using the Microsoft Graph API versin 1.0 to update a batch of user and for some I receive the following error message:
Another object with the same value for property proxyAddresses already exists.
This happens with some few user, but not with many others.
However I don't understand what it means and how to workaround it.
Any ideas?
Update1:
This my the JSON payload sent with the request:
{
"addLicenses":[
{
"disabledPlans": [
"76846ad7-7776-4c40-a281-a386362dd1b9",
"54fc630f-5a40-48ee-8965-af0503c1386e",
"c68f8d98-5534-41c8-bf36-22fa496fa792",
"8c7d2df8-86f0-4902-b2ed-a0458298f3b3",
"9e700747-8b1d-45e5-ab8d-ef187ceec156",
"c87f142c-d1e9-4363-8630-aaea9c4d9ae5",
"b8afc642-032e-4de5-8c0a-507a7bba7e5d",
"2078e8df-cff6-4290-98cb-5408261a760a"
],
"skuId":"94763226-9b3c-4e75-a931-5c89701abe66"
}],
"removeLicenses":[]
}
Based on the error message, the property proxyAddresses should be unique.
Please make sure you don't configure the same proxyAddresses for multiple users when updating users.
In theory, this property cannot be updated through the Microsoft Graph API. So if you didn't put proxyAddresses in the body, please share the requests of the updated users which have this issue.
this may be old, I encountered a similar issue. I am doing a graph api call which indirectly updates some of user attributes, so getting this error. The tenant admin should check for duplicate records and remove or update them, they can follow this link

How to avoid null insertion in pymongo?

I have an application where I let users access other third party applications and fetch data from them and perform some visualizations.For the ease of users, I only ask them to send the credentials once through POST request and then store it in Mongodb so next time onwards they ask for data without having to pass the credentials again and again.Now I plan to avoid duplication in my Mongodb database.So even though the user sends their credential, I don't reinsert it rather I use the upsert option.
users.update(doc, doc, upsert=True)
This does the trick but now when the user doesn't send any credentials, mongodb creates an object id for the particular request and puts None to value of each of the fields
{'account_id': None, 'password': None, 'username': None}
I have checked the following resource for the problem but the suggestions are specific to mongodb and not pymongo.
Avoid insertion in mongoDB Without Data
How do I ensure that I do not insert data with null values into my database?
You could use a simple if to make sure the doc is not None.
if doc:
users.update(doc, doc, upsert=True)
A database level solution is create a collection schema as pointed at resource that you linked at your question. The validators will guarantee correct insertions and upsertions.

Feathersjs filter results

I have created a node/feathers project using this chat application guide as a base. It's working great, but now I would like to filter the results the api is giving. For example, when user makes GET request to /messages I would like the response to include only the messages that the authorized user has created, not anyone else's messages. Auth is working correctly in the api and message items have the userId who created the message, but I just don't understand what and where I'm supposed to do to filter the messages according to the user id. After hours of googling I couldn't find anything related to this or anyone even asking the question, so what am I missing here?
You can do a manual filtering. Both on before and after hooks. How to use hooks.
In before hooks you can create a function that update your query object to only get/find data it owns.
hook.params.query = { ... , ownedBy: hook.params.user._id }
Or do result filtering in after hooks, you have the hook.result which is the only thing you can manipulate in the after hooks. Then you can use Array.prototype.filter() to filter the results the user gets.

Detail of list without user authentication

I'm trying to get details of Foursquare list by PHP library:
$foursquare = new FoursquareAPI($key,$secret);
$list = $foursquare->GetPublic('lists/'.$listId);
But everytime gets this error:
string(7672) "{"meta":{"code":200,"errorType":"deprecated","errorDetail":"Please provide an API version to avoid future errors.See https:\/\/developer.foursquare.co ... "
When I debug it, library calls this URL: https://api.foursquare.com/v2/lists/ with these params: Array ( [client_id] => <client_id> [client_secret] => <client_secret> )
But when I try this API method in Foursquare API Explorer I see that, this URL is calling: OAuth token automatically added. https://api.foursquare.com/v2/lists/<list_id>?oauth_token=<token>&v=20111205.
In lists doc is Requires Acting User: No, so I'm confused. Is it possible to call this function without authenticating user?
It would be nice, because I want to add places from my list (favourite restaurants) to my page on Google map in Contacts. It would be useful for our clients.
The error you are seeing is unrelated to the list endpoint you are requesting or the state of authentication. It is a warning that the library you are using is currently not following versioning best practice for Foursquare. You can read more about it here.
As for the list there should be a response object at the same level as the meta object.

Resources