Microsoft Graph API - not able to use orderby or filter on createdDateTime for Sites - c#

I want to query Sites using Microsoft Graph API that were created after a certain time. So I created the following filter query:
createdDateTime ge 2023-01-01T00:00:00Z
I also tried:
createdDateTime ge `2023-01-01T00:00:00Z`
Both generated an invalid request error with no details.
I then tried just doing an orderby createdDateTime. This did "work" but it sorted each page, not the whole dataset. So page 2 had items that should have been in page 1 and so on.
Microsoft Graph API seems really crappy. Does anybody know how to achieve this? Any help would be greatly appreciated.

I've never found a way how to use filter on /sites endpoint.
I'm using /search/query endpoint for searching SharePoint sites based on some criterion.
You should be able to specify filter by Created and properties for sorting.
POST https://graph.microsoft.com/v1.0/search/query
{
"requests": [
{
"entityTypes": [
"site"
],
"query": {
"queryString": "Created > 2022-01-01 AND Created < 2022-12-31"
},
"from": 0,
"size": 25,
"sortProperties": [
{
"name": "Created",
"isDescending": "false"
}
]
}
]
}

Related

Exact Permissions\actions needed to List Azure Resources using C# rest API

I am trying to list all resources in a Subscription using Rest API Call.
https://management.azure.com/subscriptions/{SubscriptionID}/resources?api-version=2021-04-01
It works fine when I run it with Built-In RBAC Role Reader Permissions. For security reasons, I wanted to avoid having read access to entire scope of subscription. So, I need to create a Custom Role with specific permissions\actions to list all Resources in a Subscription.
I am trying with below Custom Role but not able to get any response from Rest API call.
{
"properties": {
"roleName": "AzResourceTest",
"description": "To test the exact ACLs needed to get Resources List from a Subscription",
"assignableScopes": [
"/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
],
"permissions": [
{
"actions": [
"Microsoft.Resources/resources/read"
],
"notActions": [],
"dataActions": [],
"notDataActions": []
}
]
}
}
Can someone please suggest what should I use in actions to get resources.
Got it. "Microsoft.Resources/subscriptions/resources/read" is the action for Custom Role to list resources in a subscription

Facebook graph api 2.9 get total count of friends only

I can get JSON with all fields related to user_friends scope. However, from version 2.0 API returns mostly empty data[](if non of user's friend uses this app). Currently what I get is:
"friends": {
"data": [],
"summary": {
"total_count": 142
}
}
I want to extract only summary with total count of user's friends. So what I want to get is
"friends": {
"summary": {
"total_count": 142
}
}
Is this even possible?
I didn't find anything helpful about this in documentation, so any help is appreciated.

Dynamically add text/data to a DocuSign template

I'm implementing an API that is written in C# using ASP.NET Web API. The implementation of our API calls out to DocuSign e.g. in order to request signatures for contracts. Our application interacts with DocuSign through its REST API.
I would like to be able to create a template for our contract document and then simply reference this template when sending the contract via the REST API.
The issue I have is that the contract document needs to include data that is queried from our database, e.g. a list of products that are specific to a recipient.
Is it possible to add placeholders in the template that can then be replaced, via the REST API, with recipient-specific text/data that is queried from a database?
Yes this is easy to do through the API. Let's say you want to get a person's name and SSN and have a template that has two data fields in it called ApplicantName and ApplicantSSN. By referring to the tabLabel of each you can dynamically set their values, so for instance:
{
"accountId": "221765",
"emailSubject": "DocuSign API Example",
"templateId": "44D9E888-3D86-4186-8EE9-7071BC87A0DA",
"templateRoles": [
{
"email": "sally.doe#email.com",
"name": "Sally Doe",
"roleName": "RoleOne",
"tabs": {
"textTabs": [
{
"tabLabel": "ApplicantName",
"value": "John Doe"
},
{
"tabLabel": "ApplicantSSN",
"value": "12-345-6789"
}
]
}
}
],
"status": "sent"
}
Just make sure you exactly match the name you set in the UI with the tabLabel you set through the API call.

PayPal Rest API - Update Billing Plan Return URL

I have been using the PayPal Rest API and have successfully created and activated a BillingPlan but I'm having trouble updating said plan's return_url. I think it's something to do with the JSON path I'm using although I'm not sure why!?
Anyway, I am calling the update plan method: https://developer.paypal.com/docs/api/#update-a-plan
A BillingPlan follows the format:
{
"id": "P-94458432VR012762KRWBZEUA",
"state": "ACTIVE",
"name": "T-Shirt of the Month Club Plan",
"description": "Template creation.",
"type": "FIXED",
...
"merchant_preferences": {
"setup_fee": {
"currency": "USD",
"value": "1"
},
"max_fail_attempts": "0",
"return_url": "http://example.com",
"cancel_url": "http://example.com",
"auto_bill_amount": "YES",
"initial_fail_amount_action": "CONTINUE"
},
...
}
I'm using the C# SDK but my request JSON should look very much like:
{
"path": "merchant_preferences",
"value": {
"return_url": "http://example.com/payment/return"
},
"op": "replace"
}
I keep getting responses along the line's of:
{"name":"BUSINESS_VALIDATION_ERROR","details":[{"field":"validation_error","issue":"Invalid
Path provided."}],"message":"Validation
Error.","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#BUSINESS_VALIDATION_ERROR","debug_id":"2ae68f9f0aa72"}
To sum up - I want to change the billing plan return_url from http://example.com to http://example.com/payment/return.
I've changed the path to various things to no avail. Can anyone help??
You cannot update the plan, once it is set to active. The reason for that restriction is that because there could be possible agreements based on that plan, modifying it would affect the already agreed billing agreements.
However, I agree with your problem statement, that changing the Return URL should not be an issue as this is not a part of agreement, but more of a configuration change. It would be nice to somehow allow updating similar settings in Plan, even after active. I will let the API team know about that.
however, in the mean time, there is no way you would be able to do that. Alternatively, you could possibly create a new plan, and use that instead. Not the answer you are looking for, but a probable solution.

Nextpagetoken not working as desired

There are a lot of videos in the channel. Where as 'nextPageToken' only
iterates about 570 of them on my code.
Perhaps not a lib issue because the same happens on https://developers.google.com/youtube/v3/docs/search/list. After about only 10 pages the nextPageToken disappears.
You should using channel+playlistItems API to get ALL channel videos, not search API.
Kindly check it out on https://developers.google.com/youtube/v3/docs/channels/list#try-it.
Example, i set the channel id UCi-Lb1gFer4U7tkqFA1adiQ and part parameter as contentDetails.
the example of response is:
"items": [
{
"id": "UCi-Lb1gFer4U7tkqFA1adiQ",
"kind": "youtube#channel",
"etag": "\"NT-fDeVOLsFPouddIzcaWbd0fJw/sQKRHjGLTreNbWWrW3gIojOKiEk\"",
"contentDetails": {
"relatedPlaylists": {
"uploads": "UUi-Lb1gFer4U7tkqFA1adiQ"
}
}
}
]
Then you know the uploads playlist id now, UUi-Lb1gFer4U7tkqFA1adiQ, so you visit
https://developers.google.com/youtube/v3/docs/playlistItems/list
Put UUi-Lb1gFer4U7tkqFA1adiQ as the playlistId, then you would able to get all the videos by pagination.
p/s: please provide your channel id, if you still experience the problem

Categories