Twitter ads API "GET /1/stats/accounts/:account_id" unauthorized access - twitter

I am using postman APP for accessing GET request through TWITTER API. Though I am able to generate output through all other GET and POST request through OAUTH 1.0. But when I am sending the request through "GET /1/stats/accounts/:account_id" method, its generating the following error.
{
"errors": [
{
"code": "UNAUTHORIZED_ACCESS",
"message": "This request is not properly authenticated"
}
],
"request": {
"params": {}
}
}
I am using the following request : "https://ads-api.twitter.com/1/stats/accounts/:18ce53yh9sw?entity_ids=88hjg&entity=CAMPAIGN&end_time=2017-05-14T17:00:00Z&granularity=HOUR&metric_groups=BILLING&placement=ALL_ON_TWITTER&start_time=2017-05-05T15:00:00Z"
This is the most important GET request for me to get the campaign level data. Any other way around may be helpful.
UPDATE:
The following request is working for https://ads-api.twitter.com/1/accounts/:account_id
{
"request": {
"params": {}
},
"data": [
{
"name": "Wadi.com",
"business_name": null,
"timezone": "Asia/Riyadh",
"timezone_switch_at": "2013-05-21T21:00:00Z",
"id": "18ce53yh9sw",
"created_at": "2015-03-12T07:33:09Z",
"salt": "0f034423fa35f95e8efc844a25c4d7a3",
"updated_at": "2017-05-17T06:03:58Z",
"business_id": null,
"approval_status": "ACCEPTED",
"deleted": false
}
],
"data_type": "account",
"total_count": 1,
"next_cursor": null
}
Regards
Shree Kant

Related

Graph API search query error - Unexpected segment DynamicPathSegment. Expected property/$value

I am unable to search using microsoft graph api. The documentation is here.
Below is the sample provided in documentation, which itself is not working. Can someone suggest please. I actually want to search for people (and as per documentation /search is recommended way over /people. with /people query I am getting issue as faced in another thread)
URL : https://graph.microsoft.com/v1.0/users/<my mailbox name>/search/query
Request data:
{
"requests": [
{
"entityTypes": [
"message"
],
"query": {
"queryString": "contoso"
},
"from": 0,
"size": 25
}
]
}
Response:
{
"error": {
"code": "Request_BadRequest",
"message": "Unexpected segment DynamicPathSegment. Expected property/$value.",
"innerError": {
"date": "2023-01-18T16:19:05",
"request-id": "29a310fe-b5cf-4ea1-a995-3a09941d6d13",
"client-request-id": "29a310fe-b5cf-4ea1-a995-3a09941d6d13"
}
}
}
Send the POST request to https://graph.microsoft.com/beta/search/query endpoint.
POST https://graph.microsoft.com/beta/search/query
Request body
{
"requests": [
{
"entityTypes": [
"person"
],
"query": {
"queryString": "Sandeep"
},
"from": 0,
"size": 25
}
]
}
Searching for people requires delegated permissions.
Searching only works for searching the signed-in user's relevant people, not for searching people relevant to other users.

Unable to retrieve event details using Microsoft Graph API 1.0

Has anyone got Microsoft Graph API working for EventMessage? i.e reading email content of EventMessage using Graph API.
Looks like it has actionable card and graph API 1.0 is not able to read it.
Provided delegate access to user for a room resource.
On event creation for that room, mail is received by the delegated user in inbox. The mail type is eventMessage ("#odata.type": "#microsoft.graph.eventMessage").
On fetching the mail through GraphAPI v1.0, the event values are not visible in the response.
Also on setting the Expand property for the mail in graph API as per docs, results in below error.
{ "error": {
"code": "BadRequest",
"message": "Parsing Select and Expand failed.",
"innerError": {
"request-id": "310bbcce-bdd8-4cb6-890c-035243a5ab6d",
"date": "2020-01-21T09:18:10"
}
}
}
I'm unable to repro your issue. The Microsoft Graph API returns details for event messages. Can you provide repro steps, request/response capture, and the values that you'd expect to see?
I used v1.0/me/messagesto get all of the messages to find an eventMessage. I then perform the following to get details on the eventMessage:
GET https://graph.microsoft.com/v1.0/me/messages/{messagedId}
Response body:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('d09-94-498-a9777d4b')/messages/$entity",
"#odata.type": "#microsoft.graph.eventMessage",
"#odata.etag": "W/\"DAA2pU9s\"",
"id": "AAMkADEzOTExYjJkAAA=",
"createdDateTime": "2020-01-24T14:47:24Z",
"lastModifiedDateTime": "2020-01-24T21:08:07Z",
"changeKey": "DApU9s",
"categories": [],
"receivedDateTime": "2020-01-24T14:47:25Z",
"sentDateTime": "2020-01-24T14:47:11Z",
"hasAttachments": false,
"internetMessageId": "<AM5P3M#A38.EURPRD83.prod.outlook.com>",
"subject": "Accepted: Microsoft Graph DevX Roadmap",
"bodyPreview": "",
"importance": "normal",
"parentFolderId": "AAMk3AAA=",
"conversationId": "AAQkADEzOU4=",
"conversationIndex": "AdXReVPepTg==",
"isDeliveryReceiptRequested": null,
"isReadReceiptRequested": false,
"isRead": true,
"isDraft": false,
"webLink": "https://outlook.office365.com/owa/?ItemID=AAMkA%3D&exvsurl=1&viewmodel=ReadMessageItem",
"inferenceClassification": "focused",
"meetingMessageType": "meetingAccepted",
"body": {
"contentType": "text",
"content": ""
},
"sender": {
"emailAddress": {
"name": "Nicole",
"address": "sig#contoso.com"
}
},
"from": {
"emailAddress": {
"name": "Nicole",
"address": "sig#contoso.com"
}
},
"toRecipients": [
{
"emailAddress": {
"name": "Michael Mainer",
"address": "mm#contoso.com"
}
}
],
"ccRecipients": [],
"bccRecipients": [],
"replyTo": [],
"flag": {
"flagStatus": "notFlagged"
}
}

Pull Request Statuses - Added custom properties to a status aren't getting persisted by TFS

We are operating a TFS 2018 Update 2 in our enviroment.
We are sending the example json found here to our server and it is getting accepted successfully:
{
"properties": {
"sampleId": 7,
"customInfo": "Custom status information",
"startedDateTime": {
"$type": "System.DateTime",
"$value": "2017-09-19T14:50:26.7410146Z"
},
"weight": {
"$type": "System.Double",
"$value": 1.75
},
"bytes": {
"$type": "System.Byte[]",
"$value": "dGhpcyBpcyBzYW1wbGUgYmFzZTY0IGVuY29kZWQgc3RyaW5n"
},
"globalId": {
"$type": "System.Guid",
"$value": "1e788cb9-9d3d-4dc6-ac05-822092d17f90"
}
},
"state": "succeeded",
"description": "Sample status succeeded",
"context": {
"name": "sample-status-1",
"genre": "vsts-samples"
},
"targetUrl": "http://fabrikam-fiber-inc.com/CI/builds/1"
}
But the response doesn't look like in the documentation. Instead it looks like this:
{
"id": 6,
"state": "succeeded",
"description": "Sample status succeeded",
"context": {
"name": "sample-status-1",
"genre": "vsts-samples"
},
"creationDate": "2019-12-11T16:14:05.0574648Z",
"updatedDate": "2019-12-11T16:14:05.0574648Z",
"createdBy": {
"displayName": "...",
"url": "https://.../_apis/Identities/0b85e078-130d-4cb8-a450-17c5c7efccec",
"_links": {
"avatar": {
"href": "https://.../_api/_common/identityImage?id=0b85e078-130d-4cb8-a450-17c5c7efccec"
}
},
"id": "0b85e078-130d-4cb8-a450-17c5c7efccec",
"uniqueName": "...",
"imageUrl": "https://.../_api/_common/identityImage?id=0b85e078-130d-4cb8-a450-17c5c7efccec"
},
"targetUrl": "http://fabrikam-fiber-inc.com/CI/builds/1",
"_links": {
"self": {
"href": "https://.../_apis/git/repositories/35fe73eb-7af1-4bba-bf04-545611fcac1d/pullRequests/58/statuses/6"
},
"repository": {
"href": "https://.../_apis/git/repositories/35fe73eb-7af1-4bba-bf04-545611fcac1d"
}
}
}
The properties are gone. What could be wrong?
Could it be a somehow completely missleading documentation?
To troubleshoot your issue, please check the following items:
Check whether the Status updated on the pull request after running the POST request.
Press F12 in your browser, and send the POST request to check the statuses to see whether you can get properties in the response body.
Check your TFS edition by going to Administration Console -- Application Tier, or checking the About on the web portal. The issue can not be reproduced in TFS 2018.2 on our side.

Microsoft Graph API group folder invite response is wrong

I have been trying to grant a single user (possibly outside of the organization) access to a folder used by a shared group in Share Point The Microsoft Graph Docs state that the response should have an Id in it.
If I use a personal oneDrive account, and make the following request:
POST v1.0
https://graph.microsoft.com/v1.0/groups/{groupId}/drive/items/{folderId}/invite
body: {
"requireSignIn": true,
"sendInvitation": true,
"roles": [ "read"],
"recipients": [
{ "email": "{myPersonalEmail}" },
],
"message": "testing giving permission to self"
}
I get the following response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(permission)",
"value": [
{
"#odata.type": "#microsoft.graph.permission",
"id": "{permissionID}",
"roles": [
"read"
],
"grantedTo": {
"user": {
"email": "{myPersonalEmail}",
"id": "{responseID}",
"displayName": "Sarah"
}
}
}
]
}
However, we setup a different SharePoint account that when I make the same request https://graph.microsoft.com/v1.0/groups/{groupId}/drive/items/{folderId}/invite
I get a completely different response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(permission)",
"value": [
{
"#odata.type": "#microsoft.graph.permission",
"roles": [
"read"
],
"invitation": {
"signInRequired": true
},
"link": {
"type": "view",
"webUrl": "{shareURL}"
}
}
]
}
This is so bizarre to me, because we are hitting the same endpoint. It makes me think that maybe there are some site configurations that are making these two responses differ.
Does anyone know why we would be getting a different results from the same endpoint?

Unable to access Google Plus API in browser

i am working on to display wall posts (Stream) data using Google Plus API.
i have valid Client ID + API_KEY.
I am able to get response from Google Plus cloud console.i.e. by executing method I get Something like
Request
GET https://www.googleapis.com/plus/v1/people/myuserid/activities/public?maxResults=5&key={YOUR_API_KEY}
X-JavaScript-User-Agent: Google APIs Explorer
Response
200 OK
Show headers -
{
"kind": "plus#activityFeed",
"etag": "\"Mwea3qudNDf-hWWlPWi3n-YrU1Q/ovxXa0lmTRbwzkDa9o_iJ2pdFBs\"",
"nextPageToken": "CAIQgIi2z8bDugIgASgB",
"title": "Google+ List of Activities for Collection PUBLIC",
"updated": "2013-11-01T12:07:44.665Z",
"items": [
{
"kind": "plus#activity",
"etag": "\"Mwea3qudNDf-hWWlPWi3n-YrU1Q/JdSanh1QlMQ72Ubbabsiz2rP4B8\"",
"published": "2013-11-01T12:07:44.665Z",
"updated": "2013-11-01T12:07:44.665Z",
"id": "id",
"url": "https://plus.google.com/userid/posts/bYSPSVjXCXL",
"actor": {
"id": "116100754354787768146",
"displayName": "name",
"url": "https://plus.google.com/userid",
"image": {
"url": "someurl"
}
},
"verb": "post",
"object": {
"objectType": "note",
"content": "",
"url": "https://plus.google.com/userid/posts/bYSPSVjXCXL",
"replies": {
"totalItems": 1,
"selfLink": "https://content.googleapis.com/plus/v1/activities/z13xulwx3qjuxnkii04cjpsqgsjlyp2j23o/comments"
},
}
........
Seems good till now..but,when i use Request URL i.e https://www.googleapis.com/plus/v1/people/myuserid/activities/public?maxResults=5&key={MY_API_KEY} i got something from browser like this
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "accessNotConfigured",
"message": "Access Not Configured"
}
],
"code": 403,
"message": "Access Not Configured"
}
}
where i am going wrong ?! how to get correct response from Browser. ? as i want to parse them and use these data in my Application.
NOTE: Google + API is ON.
Are you making sure that you have replaced {MY_API_KEY} with the API key that you have generated using the Cloud Console?
Are you using the Browser Key? It works OK for me.

Resources