How can I write a strapi query to get my posts and image from a category content type - strapi

I created a collection type 'posts' and created many posts. Now I made another collection-type of category with ['softwaresApps','gifts','technology'] title that holds relations of posts. then i tried fetching with http://localhost:1337/api/categories?populate=*" and get:
{
"data": [
{
"id": 1,
"attributes": {
"title": "Technology",
"createdAt": "2022-01-09T00:43:05.899Z",
"updatedAt": "2022-01-09T00:45:26.131Z",
"publishedAt": "2022-01-09T00:44:04.298Z"
}
},
{
"id": 2,
"attributes": {
"title": "Gifts",
"createdAt": "2022-01-09T00:43:48.196Z",
"updatedAt": "2022-01-09T00:43:53.979Z",
"publishedAt": "2022-01-09T00:43:53.961Z"
}
},
{
"id": 3,
"attributes": {
"title": "softwares&apps",
"createdAt": "2022-01-09T00:48:23.706Z",
"updatedAt": "2022-01-11T00:06:48.130Z",
"publishedAt": "2022-01-09T00:49:59.571Z"
}
},
{
"id": 4,
"attributes": {
"title": "HomeSlider",
"createdAt": "2022-01-15T15:06:23.122Z",
"updatedAt": "2022-01-15T15:06:30.272Z",
"publishedAt": "2022-01-15T15:06:30.259Z"
}
}
],
"meta": {
"pagination": {
"page": 1,
"pageSize": 25,
"pageCount": 1,
"total": 4
}
}
}
I can't seem to find my posts relations in the data. I need a query that can help me fetch all the posts & images from the cateories.

I have figured it out. thanks to #IceJonas, his link:
https://stackoverflow.com/a/70251184/17908449
It turns out populating with http://localhost:1337/api/categories?populate=*" is not going to cut it. I found the solution whereby you have to populate deeper using - http://localhost:1337/api/categories?populate[posts][populate]=* and you will populate all the relations including their images.
{
"data": [
{
"id": 1,
"attributes": {
"softwareapps": "softwareapps",
"createdAt": "2022-01-18T01:42:01.223Z",
"updatedAt": "2022-01-18T01:43:37.935Z",
"publishedAt": "2022-01-18T01:43:37.931Z",
"posts": {
"data": [
{
"id": 3,
"attributes": {
"title": "The Best Drones for Photos and Video",
"date": "2022-01-11",
"article": "The **most** of your time with a _laptop_ is spent in a browser, you can get a better experience for your money with a [Chromebook.](wirecutter.com) \n\nNena Farrell has covered technology and connected home products since 2016, originally at Sunset Magazine (where she was an associate home editor) and now as an updates writer on the audio, visual, and smart-home team at Wirecutter.\n\nBrendan Nystedt contributed to an earlier version of this guide. He’s been an enthusiast photographer and a writer covering consumer electronics and tech for the better part of a decade. Nystedt has worked for Wirecutter, Reviewed, and Wired, and he has written for numerous other outlets.\n\nWhile preparing this guide, we consulted reviews both from owners and from trustworthy outlets, such as Wired and PCMag. Unfortunately for the layperson shopping for these devices, there are many SEO-driven clickbait blogs offering hands-off reviews. We ignored those websites.\n\n",
"createdAt": "2022-01-09T00:07:30.402Z",
"updatedAt": "2022-01-16T23:27:06.589Z",
"publishedAt": "2022-01-09T00:07:33.230Z",
"author": "chisom ifem",
"subCategory": "phone",
"postId": "3",
"readTime": "4",
"category": "softwareapps",
"popular": true,
"homeStartHere": false,
"slug": "The-Best-Drones-for-Photos-and-Video",
"image": {
"data": {
"id": 17,
"attributes": {
"name": "pg5.jpg",
"alternativeText": "pg5.jpg",
"caption": "pg5.jpg",
"width": 1470,
"height": 735,
"formats": {
"thumbnail": {
"name": "thumbnail_pg5.jpg",
"hash": "thumbnail_pg5_cbcb14de57",
"ext": ".jpg",
"mime": "image/jpeg",
"width": 245,
"height": 123,
"size": 12.24,
"path": null,
"url": "/uploads/thumbnail_pg5_cbcb14de57.jpg"
},
"large": {
"name": "large_pg5.jpg",
"hash": "large_pg5_cbcb14de57",
"ext": ".jpg",
"mime": "image/jpeg",
"width": 1000,
"height": 500,
"size": 63.18,
"path": null,
"url": "/uploads/large_pg5_cbcb14de57.jpg"
},
"medium": {
"name": "medium_pg5.jpg",
"hash": "medium_pg5_cbcb14de57",
"ext": ".jpg",
"mime": "image/jpeg",
"width": 750,
"height": 375,
"size": 39.5,
"path": null,
"url": "/uploads/medium_pg5_cbcb14de57.jpg"
},
"small": {
"name": "small_pg5.jpg",
"hash": "small_pg5_cbcb14de57",
"ext": ".jpg",
"mime": "image/jpeg",
"width": 500,
"height": 250,
"size": 23.05,
"path": null,
"url": "/uploads/small_pg5_cbcb14de57.jpg"
}
},
"hash": "pg5_cbcb14de57",
"ext": ".jpg",
"mime": "image/jpeg",
"size": 93.38,
"url": "/uploads/pg5_cbcb14de57.jpg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"createdAt": "2022-01-12T23:37:47.189Z",
"updatedAt": "2022-01-12T23:37:47.189Z"
}
}
}
}
},
{
"id": 2,
"attributes": {
"title": "The Best Mop-Vacuum Combo Is the Bissell CrossWave",
"date": "2022-01-10",
"article": "The Aeezo Portrait 01 is considerably cheaper than our other picks (it’s nearly half the price of the Aura Mason), and it’s surprisingly good. The frame is minimalist but doesn’t look cheap, and the Aeezo has a unique feature that allows you to easily re-crop a photo so that no matter the orientation, it always looks good. The downside is the uploader, which limits you to 10 pictures at a time and is overall frustrating for the less-tech-savvy to navigate and understand.\n\n# This is the end hommies",
"createdAt": "2022-01-09T00:00:30.997Z",
"updatedAt": "2022-01-17T00:19:05.116Z",
"publishedAt": "2022-01-11T22:24:52.541Z",
"author": "Emeka olumma",
"subCategory": "phone",
"postId": "2",
"readTime": "3",
"category": "gifts",
"popular": true,
"homeStartHere": false,
"slug": "The Best-Mop-Vacuum-Combo-is-the-Bissell-CrossWave",
"image": {
"data": {
"id": 21,
"attributes": {
"name": "slide2.jpg",
"alternativeText": "slide2.jpg",
"caption": "slide2.jpg",
"width": 1470,
"height": 735,
"formats": {
"thumbnail": {
"name": "thumbnail_slide2.jpg",
"hash": "thumbnail_slide2_de6b7dcd32",
"ext": ".jpg",
"mime": "image/jpeg",
"width": 245,
"height": 123,
"size": 11.51,
"path": null,
"url": "/uploads/thumbnail_slide2_de6b7dcd32.jpg"
},
"large": {
"name": "large_slide2.jpg",
"hash": "large_slide2_de6b7dcd32",
"ext": ".jpg",
"mime": "image/jpeg",
"width": 1000,
"height": 500,
"size": 43.34,
"path": null,
"url": "/uploads/large_slide2_de6b7dcd32.jpg"
},
"medium": {
"name": "medium_slide2.jpg",
"hash": "medium_slide2_de6b7dcd32",
"ext": ".jpg",
"mime": "image/jpeg",
"width": 750,
"height": 375,
"size": 30.53,
"path": null,
"url": "/uploads/medium_slide2_de6b7dcd32.jpg"
},
"small": {
"name": "small_slide2.jpg",
"hash": "small_slide2_de6b7dcd32",
"ext": ".jpg",
"mime": "image/jpeg",
"width": 500,
"height": 250,
"size": 19.62,
"path": null,
"url": "/uploads/small_slide2_de6b7dcd32.jpg"
}
},
"hash": "slide2_de6b7dcd32",
"ext": ".jpg",
"mime": "image/jpeg",
"size": 52.52,
"url": "/uploads/slide2_de6b7dcd32.jpg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"createdAt": "2022-01-15T15:33:30.925Z",
"updatedAt": "2022-01-15T15:33:30.925Z"
}
}
}
}
},
{
"id": 6,
"attributes": {
"title": "Laptop you can buy now in 2022",
"date": "2022-01-14",
"article": "A digital photo frame lets you easily add images—including beautiful travel shots and family photos—to the frame from anywhere. Whether you’re giving a frame as a gift and plan to upload photos remotely, or you just want a great frame for yourself, the Aura Mason is the best frame we’ve used. Its 8.57-inch display is sharp, bright, and vivid, and in our tests it was the simplest to set up. On top of that, it has a good-looking design.\n\nOf all the frames we tried, the Aura Mason came the closest to mimicking a regular photo frame. The Mason is straightforward to set up and use, and remotely loading photos is a breeze (the free Aura app works with Android and iOS phones). With this frame it is easy to add photos on the app or through a web uploader. From the intuitive design of the app to the frame’s pared-down interface, the Mason is not just for the tech-savvy.\n\n\n### The Aura Mason\nThe Aura Mason Luxe is an upgrade to the Mason, with a larger price tag. That extra cost adds a slightly larger 2K screen and video capabilities onto everything we already like about the Mason frame. But even though the video capabilities are nice, we don’t think they’re truly necessary in order to enjoy a digital picture frame.\n\n\n\nThe [Aeezo Portrait](wirecutter.com) 01 is considerably cheaper than our other picks (it’s nearly half the price of the Aura Mason), and it’s surprisingly good. The frame is minimalist but doesn’t look cheap, and the Aeezo has a unique feature that allows you to easily re-crop a photo so that no matter the orientation, it always looks good. The downside is the uploader, which limits you to 10 pictures at a time and is overall frustrating for the less-tech-savvy to navigate and understand.\n\n",
"createdAt": "2022-01-09T00:18:35.467Z",
"updatedAt": "2022-01-16T23:05:11.379Z",
"publishedAt": "2022-01-09T00:18:38.306Z",
"author": "John juzzy",
"subCategory": "phone",
"postId": "6",
"readTime": "3",
"category": "softwareapps",
"popular": false,
"homeStartHere": false,
"slug": "Laptop-you-can-buy-now-in-2022",
"image": {
"data": {
"id": 13,
"attributes": {
"name": "kids3.png",
"alternativeText": "kids3.png",
"caption": "kids3.png",
"width": 206,
"height": 142,
"formats": null,
"hash": "kids3_eee4bde396",
"ext": ".png",
"mime": "image/png",
"size": 54.89,
"url": "/uploads/kids3_eee4bde396.png",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"createdAt": "2022-01-09T00:16:21.166Z",
"updatedAt": "2022-01-09T00:16:21.166Z"
}
}
}
}
}
]
}
}
}
],
"meta": {
"pagination": {
"page": 1,
"pageSize": 25,
"pageCount": 1,
"total": 1
}
}
}
I hope this helps someone.

Related

How to get failed step number in Azure pipeline?

There is a step in my Azure pipeline yaml that requires the step number of the first failed step. Is there a way to retrieve this information (preferably in a bash task)?
The idea is to retrieve the logs of the failed step .../_apis/build/builds/777777/logs/3
I'm not good at bash scripting but you need to:
Call Azure DevOps REST API first on timeline endpoint:
https://dev.azure.com/{{organization}}/{{project}}/_apis/build/builds/3477/timeline?api-version=6.0
where 3477 is your build id.
Then go through response and find first record with result=failed:
{
"previousAttempts": [],
"id": "5caf77c8-9b10-50ef-b5c7-ca89c63e1c86",
"parentId": "12f1170f-54f2-53f3-20dd-22fc7dff55f9",
"type": "Task",
"name": "Run a multi-line script",
"startTime": "2020-09-07T12:00:04.5033333Z",
"finishTime": "2020-09-07T12:00:04.7466667Z",
"currentOperation": null,
"percentComplete": null,
"state": "completed",
"result": "failed",
"resultCode": null,
"changeId": 10,
"lastModified": "0001-01-01T00:00:00",
"workerName": "Hosted Agent",
"order": 4,
"details": null,
"errorCount": 1,
"warningCount": 0,
"url": null,
"log": {
"id": 7,
"type": "Container",
"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/3477/logs/7"
},
"task": {
"id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9",
"name": "CmdLine",
"version": "2.164.2"
},
"attempt": 1,
"identifier": null,
"issues": [
{
"type": "error",
"category": "General",
"message": "Bash exited with code '1'.",
"data": {
"type": "error",
"logFileLineNumber": "15"
}
}
]
},
At log property of this record you will find url to your log
"log": {
"id": 7,
"type": "Container",
"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/3477/logs/7"
},

Accessing collections data from Google+ API

I'm using the Google Plus API, and there seems to be no information in the JSON response regarding the collection of the post. I was wondering if there was a way to access which collection a post belongs using the API data.
For example, could we use the URL given to parse the collection from the webpage? Does anyone have any idea how this could be done in a performant way?
The google+ api is a read only api and every limited it gives you access to people, activities and comments.
Activites list returns a list of all activities#resource posts by a user. try it
The only collection you can send is public. the response looks like this.
{
"kind": "plus#activity",
"etag": "\"RKS4-q7QGL10FxltAebpjqjKQR0/82jivrLU7ubQ-fwlLaXGSt3krb8\"",
"title": "",
"published": "2018-06-18T07:03:54.034Z",
"updated": "2018-06-18T07:03:54.034Z",
"id": "z13lu3vowpa5x3aws04chl2brzavs1rplos0k",
"url": "https://plus.google.com/+LindaLawton/posts/STgianNMQwU",
"actor": {
"id": "117200475532672775346",
"displayName": "Linda Lawton",
"url": "https://plus.google.com/117200475532672775346",
"image": {
"url": "https://lh5.googleusercontent.com/-a1CWlFnA5xE/AAAAAAAAAAI/AAAAAAAAl1I/UcwPajZOuN4/photo.jpg?sz=50"
},
"verification": {
"adHocVerified": "UNKNOWN_VERIFICATION_STATUS"
}
},
"verb": "post",
"object": {
"objectType": "note",
"actor": {
"verification": {
"adHocVerified": "UNKNOWN_VERIFICATION_STATUS"
}
},
"content": "",
"url": "https://plus.google.com/+LindaLawton/posts/STgianNMQwU",
"replies": {
"totalItems": 0,
"selfLink": "https://content.googleapis.com/plus/v1/activities/z13lu3vowpa5x3aws04chl2brzavs1rplos0k/comments"
},
"plusoners": {
"totalItems": 0,
"selfLink": "https://content.googleapis.com/plus/v1/activities/z13lu3vowpa5x3aws04chl2brzavs1rplos0k/people/plusoners"
},
"resharers": {
"totalItems": 0,
"selfLink": "https://content.googleapis.com/plus/v1/activities/z13lu3vowpa5x3aws04chl2brzavs1rplos0k/people/resharers"
},
"attachments": [
{
"objectType": "article",
"displayName": "leastprivilege/AspNetCoreSecuritySamples",
"content": "AspNetCoreSecuritySamples - Samples for various ASP.NET Core Security Features",
"url": "https://github.com/leastprivilege/AspNetCoreSecuritySamples",
"image": {
"url": "https://lh3.googleusercontent.com/proxy/1pdxjC-TsuF0-8yHOZKvfDOXG1pNWAIemDoW7OzrFy8pcckGqr0BTJj-TwgW9KgEuoGLJjfUKLWSCouJwTT7FjoOmZ_xURQwzz4=w506-h910",
"type": "image/jpeg",
"height": 910,
"width": 506
},
"fullImage": {
"url": "https://avatars0.githubusercontent.com/u/1454075?s=400&v=4",
"type": "image/jpeg"
}
}
]
},
"provider": {
"title": "Google+"
},
"access": {
"kind": "plus#acl",
"description": "Public",
"items": [
{
"type": "public"
}
]
}
},
the above post here is actually within one of my collections. But no were in the response does it mention the id of the collection that its in which is olLcVE
As i mentioned this is a very limited api and what you want to do is not available.

How to get proposed time using Microsoft Graph API?

When the other person declined the meeting and proposed a new time. In Outlook, you can see the proposed time.
Now I am trying to use Microsoft Graph API to get that proposed time.
For example, the original meeting date is 2018-03-08, and the other person declined and proposed a new date 2018-03-12.
I tried
GET /beta/me/messages/{messageId}=?$expand=microsoft.graph.eventMessage/event
However, I cannot find the proposed time from the result returned. How can I get it? Thanks
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#users('576552d5-3bc0-42a6-a53d-bfceb405db23')/messages/$entity",
"#odata.type": "#microsoft.graph.eventMessage",
"#odata.etag": "W/\"DAAAABYAAACpTc/InBsuTYwTUBb+VIb4AADoRAyI\"",
"id": "AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk-iwQZRbXMgkfKtmYhBwCpTc-InBsuTYwTUBb_VIb4AAAAAAEMAACpTc-InBsuTYwTUBb_VIb4AADnwc8mAAA=",
"createdDateTime": "2018-03-06T22:29:10Z",
"lastModifiedDateTime": "2018-03-06T22:29:11Z",
"changeKey": "DAAAABYAAACpTc/InBsuTYwTUBb+VIb4AADoRAyI",
"categories": [],
"receivedDateTime": "2018-03-06T22:29:11Z",
"sentDateTime": "2018-03-06T22:29:05Z",
"hasAttachments": false,
"internetMessageId": "<MWHPR15MB18399806CC97C61817C9A2B18BD90#MWHPR15MB1839.namprd15.prod.outlook.com>",
"subject": "New Time Proposed: Test",
"bodyPreview": "",
"importance": "normal",
"parentFolderId": "AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgAuAAAAAACUbnk-iwQZRbXMgkfKtmYhAQCpTc-InBsuTYwTUBb_VIb4AAAAAAEMAAA=",
"conversationId": "AAQkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgAQAOnuCMgoRLdGs-1scw6i7EU=",
"conversationIndex": "AdO1mnWL6e4IyChEt0az/WxzDqLsRQAABO5D",
"isDeliveryReceiptRequested": null,
"isReadReceiptRequested": false,
"isRead": false,
"isDraft": false,
"webLink": "https://outlook.office365.com/owa/?ItemID=AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk%2FiwQZRbXMgkfKtmYhBwCpTc%2FInBsuTYwTUBb%2BVIb4AAAAAAEMAACpTc%2FInBsuTYwTUBb%2BVIb4AADnwc8mAAA%3D&exvsurl=1&viewmodel=ReadMessageItem",
"inferenceClassification": "focused",
"unsubscribeData": [],
"unsubscribeEnabled": false,
"meetingMessageType": "meetingDeclined",
"type": "singleInstance",
"isOutOfDate": false,
"isAllDay": false,
"isDelegated": false,
"body": {
"contentType": "html",
"content": "Hi"
},
"sender": {
"emailAddress": {
"name": "Rose",
"address": "rose#example.com"
}
},
"from": {
"emailAddress": {
"name": "Rose",
"address": "rose#example.com"
}
},
"toRecipients": [
{
"emailAddress": {
"name": "Jack",
"address": "jack#example.com"
}
}
],
"ccRecipients": [],
"bccRecipients": [],
"replyTo": [],
"mentionsPreview": null,
"flag": {
"flagStatus": "notFlagged"
},
"startDateTime": {
"dateTime": "2018-03-08T04:00:00.0000000",
"timeZone": "UTC"
},
"endDateTime": {
"dateTime": "2018-03-08T05:00:00.0000000",
"timeZone": "UTC"
},
"location": {
"displayName": "Test",
"locationType": "default",
"uniqueIdType": "unknown"
},
"recurrence": null,
"event#odata.context": "https://graph.microsoft.com/beta/$metadata#users('576552d5-3bc0-42a6-a53d-bfceb405db23')/messages('AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk-iwQZRbXMgkfKtmYhBwCpTc-InBsuTYwTUBb_VIb4AAAAAAEMAACpTc-InBsuTYwTUBb_VIb4AADnwc8mAAA%3D')/microsoft.graph.eventMessage/event/$entity",
"event": {
"#odata.etag": "W/\"qU3PyJwbLk2ME1AW/lSG+AAA6EQMeA==\"",
"id": "AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk-iwQZRbXMgkfKtmYhBwCpTc-InBsuTYwTUBb_VIb4AAAAAAENAACpTc-InBsuTYwTUBb_VIb4AADnwkmiAAA=",
"createdDateTime": "2018-03-06T22:28:32.3852279Z",
"lastModifiedDateTime": "2018-03-06T22:29:11.4604154Z",
"changeKey": "qU3PyJwbLk2ME1AW/lSG+AAA6EQMeA==",
"categories": [],
"originalStartTimeZone": "Pacific Standard Time",
"originalEndTimeZone": "Pacific Standard Time",
"iCalUId": "040000008200E00074C5B7101A82E0080000000000000000000000000000000000000000310000007643616C2D5569640100000033324633333433392D433744452D344338362D393046452D44424639314131363444323900",
"reminderMinutesBeforeStart": 15,
"isReminderOn": true,
"hasAttachments": false,
"subject": "Test",
"bodyPreview": "Test",
"importance": "normal",
"sensitivity": "normal",
"isAllDay": false,
"isCancelled": false,
"isOrganizer": true,
"responseRequested": true,
"seriesMasterId": null,
"showAs": "busy",
"type": "singleInstance",
"webLink": "https://outlook.office365.com/owa/?itemid=AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk%2FiwQZRbXMgkfKtmYhBwCpTc%2FInBsuTYwTUBb%2BVIb4AAAAAAENAACpTc%2FInBsuTYwTUBb%2BVIb4AADnwkmiAAA%3D&exvsurl=1&path=/calendar/item",
"onlineMeetingUrl": null,
"responseStatus": {
"response": "organizer",
"time": "0001-01-01T00:00:00Z"
},
"body": {
"contentType": "html",
"content": "Hi"
},
"start": {
"dateTime": "2018-03-08T04:00:00.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2018-03-08T05:00:00.0000000",
"timeZone": "UTC"
},
"location": {
"displayName": "Test",
"locationType": "default",
"uniqueId": "Test",
"uniqueIdType": "private"
},
"locations": [
{
"displayName": "Test",
"locationType": "default",
"uniqueId": "Test",
"uniqueIdType": "private"
}
],
"recurrence": null,
"attendees": [
{
"type": "required",
"status": {
"response": "declined",
"time": "2018-03-06T22:29:05Z"
},
"emailAddress": {
"name": "Rose",
"address": "rose#example.com"
}
}
],
"organizer": {
"emailAddress": {
"name": "Jack",
"address": "jack#example.com"
}
}
}
}
The API doesn't expose this information directly. The related entities just don't have the fields defined to show this information. However, the data is obviously there, you just need to know how to get to it. The answer lies in extended properties.
Basically since Graph doesn't expose these values, we need to dig into the MAPI properties that store this data. After a little digging through the Exchange server protocol docs I found PidLidAppointmentProposedStartWhole and PidLidAppointmentProposedEndWhole. We just need to translate those MAPI property definitions into the Graph extended property syntax.
From the doc, those are both in the PSETID_Appointment namespace, which uses the GUID {00062002-0000-0000-C000-000000000046}. PidLidAppointmentProposedStartWhole uses id 0x8250, and PidLidAppointmentProposedEndWhole uses id 0x8251. So those should translate to:
PidLidAppointmentProposedStartWhole: 'SystemTime {00062002-0000-0000-C000-000000000046} Id 0x8250'
PidLidAppointmentProposedEndWhole: 'SystemTime {00062002-0000-0000-C000-000000000046} Id 0x8251'
If we use those in an $expand clause as per Get singleValueLegacyExtendedProperty, we get something like:
GET /me/mailfolders/inbox/messages?$expand=singleValueExtendedProperties($filter=id eq 'SystemTime {00062002-0000-0000-C000-000000000046} Id 0x8250' or id eq 'SystemTime {00062002-0000-0000-C000-000000000046} Id 0x8251')
And the response looks something like this (other properties omitted):
{
"subject": "New Time Proposed: Let's meet",
"singleValueExtendedProperties": [
{
"id": "SystemTime {00062002-0000-0000-c000-000000000046} Id 0x8250",
"value": "2018-03-20T20:00:00Z"
},
{
"id": "SystemTime {00062002-0000-0000-c000-000000000046} Id 0x8251",
"value": "2018-03-20T21:00:00Z"
}
]
}

Can I sync calendar events with the Microsoft Graph API?

I'm working with the Microsoft Graph api to try and sync calendar events from Outlook. I was looking at this article concerning the Outlook api, which suggested I add the header odata.track-changes to my request and I would receive a deltaToken, which I could use on a later request to fetch only those events which had been updated or created since the last sync.
I have been successful fetching events, but I'm not getting a deltaToken back :/
Is this only supported in the Outlook api? Graph's response has Preference-Applied: odata.track-changes, so it's acknowledging my header. Here's my sample request:
GET /v1.0/me/calendar/calendarView
?startDateTime=2016-09-01T00:00:00.0000000
&endDateTime=2099-01-01T00:00:00.0000000
HTTP/1.1
Host: graph.microsoft.com
Authorization: Bearer XXX
Prefer: odata.track-changes
Prefer: odata.maxpagesize=3 //for testing
Cache-Control: no-cache
And my sample response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('')/calendar/calendarView",
"value": [
{
"#odata.etag": "",
"id": "",
"createdDateTime": "2016-08-04T14:00:25.8552351Z",
"lastModifiedDateTime": "2016-08-25T14:43:54.9950828Z",
"changeKey": "",
"categories": [
"Orange category"
],
"originalStartTimeZone": "Eastern Standard Time",
"originalEndTimeZone": "Eastern Standard Time",
"responseStatus": {
"response": "organizer",
"time": "0001-01-01T00:00:00Z"
},
"iCalUId": "",
"reminderMinutesBeforeStart": 15,
"isReminderOn": true,
"hasAttachments": false,
"subject": "Closing on House",
"body": {
"contentType": "html",
"content": ""
},
"bodyPreview": "",
"importance": "normal",
"sensitivity": "normal",
"start": {
"dateTime": "2016-09-08T19:30:00.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2016-09-08T21:30:00.0000000",
"timeZone": "UTC"
},
"location": {
"displayName": "245 E Main St",
"address": {
"street": "245 E Main St",
"city": "Somewhere",
"state": "NY",
"countryOrRegion": "United States",
"postalCode": ""
}
},
"isAllDay": false,
"isCancelled": false,
"isOrganizer": true,
"recurrence": null,
"responseRequested": true,
"seriesMasterId": null,
"showAs": "busy",
"type": "singleInstance",
"attendees": [],
"organizer": {
"emailAddress": {
"name": "",
"address": ""
}
},
"webLink": "https://outlook.office365.com/owa/?ItemID="
},
{
"#odata.etag": "",
"id": "",
"createdDateTime": "2016-08-19T18:02:39.0607411Z",
"lastModifiedDateTime": "2016-08-19T18:04:10.548447Z",
"changeKey": "",
"categories": [
"Green category"
],
"originalStartTimeZone": "UTC",
"originalEndTimeZone": "UTC",
"responseStatus": {
"response": "organizer",
"time": "0001-01-01T00:00:00Z"
},
"iCalUId": "",
"reminderMinutesBeforeStart": 15,
"isReminderOn": true,
"hasAttachments": false,
"subject": "Moving (off work)",
"body": {
"contentType": "html",
"content": ""
},
"bodyPreview": "",
"importance": "normal",
"sensitivity": "normal",
"start": {
"dateTime": "2016-09-10T00:00:00.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2016-09-13T00:00:00.0000000",
"timeZone": "UTC"
},
"location": {
"displayName": "",
"address": {}
},
"isAllDay": true,
"isCancelled": false,
"isOrganizer": true,
"recurrence": null,
"responseRequested": true,
"seriesMasterId": null,
"showAs": "oof",
"type": "singleInstance",
"attendees": [],
"organizer": {
"emailAddress": {
"name": "",
"address": ""
}
},
"webLink": "https://outlook.office365.com/owa/?ItemID="
},
{
"#odata.etag": "",
"id": "",
"createdDateTime": "2016-09-13T19:05:20.8438647Z",
"lastModifiedDateTime": "2016-09-13T19:05:22.1899702Z",
"changeKey": "",
"categories": [],
"originalStartTimeZone": "America/New_York",
"originalEndTimeZone": "America/New_York",
"responseStatus": {
"response": "organizer",
"time": "0001-01-01T00:00:00Z"
},
"iCalUId": "",
"reminderMinutesBeforeStart": 15,
"isReminderOn": true,
"hasAttachments": false,
"subject": "Coffee Break",
"body": {
"contentType": "html",
"content": ""
},
"bodyPreview": "",
"importance": "normal",
"sensitivity": "normal",
"start": {
"dateTime": "2016-09-15T20:15:00.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2016-09-15T21:15:00.0000000",
"timeZone": "UTC"
},
"location": {
"displayName": "",
"address": {}
},
"isAllDay": false,
"isCancelled": false,
"isOrganizer": true,
"recurrence": null,
"responseRequested": true,
"seriesMasterId": null,
"showAs": "busy",
"type": "singleInstance",
"attendees": [],
"organizer": {
"emailAddress": {
"name": "",
"address": ""
}
},
"webLink": "https://outlook.office365.com/owa/?ItemID="
}
]
}
I redacted anything I thought could be mildly sensitive. Ultimately, my Laravel app is trying to sync events starting 4 months back, and go forever into the future.
If there's a more efficient/better way to do it, I'm open to suggestions. If it matters, these results were generated with Postman. Any help or clarity on this is appreciated.
I ended up using the odata filter like so:
https://graph.microsoft.com/beta/me/calendar/calendarView?startDateTime=2016-05-01T00:00:00Z&endDateTime=2099-01-01T00:00:00Z&$filter=type eq 'singleInstance' and lastModifiedDateTime eq '2016-09-20T07:30:00+00:00'
This will fetch all calendar events scheduled between 2016-05-01T00:00:00Z (May 1st, 2016, midnight, UTC and 2099-01-01T00:00:00Z (January 1st, 2099, midnight, UTC) where the event type is singleInstance (not a recurring event) and the lastModifiedDateTime is after the last sync (in this example, 2016-09-20T07:30:00+00:00).
A few pitfalls with this:
Obviously, this is not url encoded. You would need to do that.
Make sure the + in the lastModifiedDateTime example is properly encoded to %2B, otherwise the Graph API will treat it as a space and reject it.
If you don't filter out recurring events, you will get each recurring event from now until 2099. This is the nature of fetching a list of calendarViews as opposed to events.
If I could do this again, I would probably go back and just do the full calendar sync, which Graph supports (I believe). I just didn't want to sync the whole calendar, only a date range, but it seems that was a doomed endeavor.
But despite the lack of recurring events, it works.
UPDATE
I ended up scrapping this implementation mostly because of the continuing pitfalls I've encountered with maintaining data sync integrity, lack of recurring events, and etc. Instead, I pull calendar events in real time, and maintain a cache. Just some advice in case anyone else ends up in my situation.

ArrowDB dashboard upload photo to user

when I upload a photo using the arrowdb dashboard on https://platform.appcelerator.com
Cloud.Users.query only shows the photo_id
but whne I created a new user using the dashboard and attached a phot it is showing in the Cloud.Users.query
eg . photo uploaded after user created
{
"id": "563019f18cb04aede69e2111",
"first_name": "store1",
"last_name": "123",
"created_at": "2015-10-28T00:42:25+0000",
"updated_at": "2016-01-22T08:59:44+0000",
"external_accounts": [],
"confirmed_at": "2015-10-28T00:42:25+0000",
"username": "user",
"admin": "false",
"stats": {
"photos": {
"total_count": 0
},
"storage": {
"used": 0
}
},
"photo_id": "56a1dc083a654d090d126792",
"friend_counts": {
"requests": 0,
"friends": 0
}
}
eg. photo uploaded while creating user
{
"id": "56a1f0333a65234234390d7",
"first_name": "qqqq",
"last_name": "wwwe",
"created_at": "2016-01-22T09:02:43+0000",
"updated_at": "2016-01-22T09:07:18+0000",
"external_accounts": [],
"confirmed_at": "2016-01-22T09:02:43+0000",
"username": "qwe",
"admin": "false",
"stats": {
"photos": {
"total_count": 0
},
"storage": {
"used": 0
}
},
"photo": {
"id": "56a1f0333a654d090d0390d8",
"filename": "userPhoto.jpg",
"size": 25394,
"md5": "e20f4fcadf6cde9fccfb458dd11951d4",
"created_at": "2016-01-22T09:02:43+0000",
"updated_at": "2016-01-22T09:02:43+0000",
"processed": true,
"urls": {
"original": "https://s3-us-west-1.amazonaws.com/storage-platform.cloud.appcelerator.com/xmqh1djNEIChtQFP6d37HNH5DQNCXQoX/photos/51/d4/56a1f0333a654d090d0390d9/userPhoto_original.jpg"
},
"content_type": "image/jpeg",
"user": {
"id": "56a1f0333a65234234390d7",
"first_name": "qqqq",
"last_name": "wwwe",
"created_at": "2016-01-22T09:02:43+0000",
"updated_at": "2016-01-22T09:07:18+0000",
"external_accounts": [],
"confirmed_at": "2016-01-22T09:02:43+0000",
"username": "qwe",
"admin": "false",
"stats": {
"photos": {
"total_count": 0
},
"storage": {
"used": 0
}
},
"photo_id": "56a1f0333a654d090d0390d8",
"friend_counts": {
"requests": 0,
"friends": 0
}
}
},
"friend_counts": {
"requests": 0,
"friends": 0
}
}
basically the user which had photo uploaded during creation shows this extra info
"photo": {
"id": "56a1f0333a654d090d0390d8",
"filename": "userPhoto.jpg",
"size": 25394,
"md5": "e20f4fcadf6cde9fccfb458dd11951d4",
"created_at": "2016-01-22T09:02:43+0000",
"updated_at": "2016-01-22T09:02:43+0000",
"processed": true,
"urls": {
"original": "https://s3-us-west-1.amazonaws.com/storage-platform.cloud.appcelerator.com/xmqh1djNEIChtQFP6d37HNH5DQNCXQoX/photos/51/d4/56a1f0333a654d090d0390d9/userPhoto_original.jpg"
},
"content_type": "image/jpeg",
"user": {
"id": "56a1f0333a65234234390d7",
"first_name": "qqqq",
"last_name": "wwwe",
"created_at": "2016-01-22T09:02:43+0000",
"updated_at": "2016-01-22T09:07:18+0000",
"external_accounts": [],
"confirmed_at": "2016-01-22T09:02:43+0000",
"username": "qwe",
"admin": "false",
"stats": {
"photos": {
"total_count": 0
},
"storage": {
"used": 0
}
},
I've been experiencing also that kind of problem, plus I've noticed that the images won't show up from the ArrowDB user interface (not sure if related).
The API returns only an empty object when you query the model:
photo: {}
I've been creating a ticket for the ArrowDB user interface https://jira.appcelerator.org/browse/API-1277.
sachinmw did you create a ticket for the initial problem yet?
A workaround could be to use the photo_id and run another separate query to retrieve the photo model but this is not good for network optimisation purposes.
EDIT
Ok after dealing with Appcelerator directly about having an empty photo: {} Object return the answer is pretty simple:
Whenever you use the query() function like Cloud.Objects.query() from ti.cloud on any ArrowDB object, there is a parameter called response_json_depth which is set to 1 by default and will only return one level of the JSON Object returned by the API.
Without touching that parameter I was seeing:
{
"Vehicle": [
{
"name": "foo",
"photo: {}
}
]
}
By setting response_json_depth to 3 I managed to have:
{
"Vehicle": [
{
"name": "foo",
"photo: {
"urls": {
"original": "http://bar.com"
}
}
}
]
}
Hope that will help someone. The also applies for the Cloud.Objects.show() method for any ArrowDB object.

Resources