Box enterprise rename event - box-api

I am developing an app for Box enterprise and I found out that rename events come with the new name but no the old one, for example
{
"source": {
"item_type": "file",
"item_id": "XXXXXXXXXXX",
"item_name": "secret file 2.txt",
"parent": {
"type": "folder",
"name": "All Files",
"id": "0"
}
},
"created_by": {
"type": "user",
"id": "XXXXXXXXX",
"name": "Ronan",
"login": "r#agora.co"
},
"created_at": "2016-06-20T09:22:55-07:00",
"event_id": "a64748af-1693-4651-af41-5eed55414677",
"event_type": "RENAME",
"ip_address": "XXX.XXX.XXX.XXX",
"type": "event",
"session_id": null,
"additional_details": {
"shared_link_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
"version_id": "67450313377"
}
}
How can I see the previous name of the file as well?

Related

Update a Contentful post using PUT request via Postman

I'm trying to update a Contentful entry using Postman.
What I did:
In Contentful space, I created a test post to play with.
Went to Settings - API Keys - Content management tokens and generated a Personal access token
Created a GET request in Postman, passing space ID, master environment, and ID of the test post:
https://cdn.contentful.com/spaces/{spaceID}i/environments/master/entries?sys.id={postID}
I also sent authorisation header with content delivery token.
The GET request goes successfully and I'm able to copy the JSON object-response.
{
"sys": {
"type": "Array"
},
"total": 1,
"skip": 0,
"limit": 100,
"items": [
{
"metadata": {
"tags": []
},
"sys": {
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "d9r4mg123x4v"
}
},
"id": "2Fwow39hxxx1bvMkjpsyV9",
"type": "Entry",
"createdAt": "2021-11-10T14:00:11.935Z",
"updatedAt": "2021-11-10T14:06:51.393Z",
"environment": {
"sys": {
"id": "master",
"type": "Link",
"linkType": "Environment"
}
},
"revision": 3,
"contentType": {
"sys": {
"type": "Link",
"linkType": "ContentType",
"id": "hotelInfo"
}
},
"locale": "en-US"
},
"fields": {
"name": "Test entry",
"slug": "test-entry",
"address": "Lviv",
"cityName": "Lviv",
"phone": "+380931231212",
"coordinates": {
"lon": -115.302,
"lat": 36.18709
},
"dog": "100",
"cat": "100",
"delivery": "100",
"photo": [
{
"sys": {
"type": "Link",
"linkType": "Asset",
"id": "2hSnYhQDJzU99NvlsYdk3k"
}
}
],
"additionalInfo": {
"data": {},
"content": [
{
"data": {},
"content": [
{
"data": {},
"marks": [],
"value": "Test",
"nodeType": "text"
}
],
"nodeType": "paragraph"
}
],
"nodeType": "document"
},
"featuredHotel": true,
"phoneClicks": 1
}
}
],
"includes": {
"Asset": [
{
"metadata": {
"tags": []
},
"sys": {
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "d9r4mg123x4v"
}
},
"id": "2hSnYhQDJzU99NvlsYdk3k",
"type": "Asset",
"createdAt": "2021-11-10T13:59:59.954Z",
"updatedAt": "2021-11-10T13:59:59.954Z",
"environment": {
"sys": {
"id": "master",
"type": "Link",
"linkType": "Environment"
}
},
"revision": 1,
"locale": "en-US"
},
"fields": {
"title": "JS",
"description": "Lorem Ipsum",
"file": {
"url": "//images.ctfassets.net/d9r4mg123x4v/2hSnYhQDJzU99NvlsYdk3k/6fbabc7be7f4b28dc8b7deadd9892205/JS.png",
"details": {
"size": 23078,
"image": {
"width": 1024,
"height": 1024
}
},
"fileName": "JS.png",
"contentType": "image/png"
}
}
}
]
}
}
Now I want to create PUT request to send the updated JSON to the Contentful.
I paste the JSON I got as a response from GET request.
I change one of the values:
"name": "Test entry"
to
"name": "Test entry 123"
I send PUT request to https://api.contentful.com/spaces/{spaceID}/environments/master/entries/{postID}
The Authorisation header contains the Personal access token I generated before.
The X-Contentful-Version header contains the version of the post, can be found in post details
When I send this request, I get JSON response with an empty "fields": {}
{
"metadata": {
"tags": []
},
"sys": {
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "d9r4mg123x4v"
}
},
"id": "2Fwow39hxxx1bvMkjpsyV9",
"type": "Entry",
"createdAt": "2021-11-10T13:57:10.882Z",
"updatedAt": "2021-11-11T10:58:39.480Z",
"environment": {
"sys": {
"id": "master",
"type": "Link",
"linkType": "Environment"
}
},
"publishedVersion": 13,
"publishedAt": "2021-11-10T14:06:51.393Z",
"firstPublishedAt": "2021-11-10T14:00:11.935Z",
"createdBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "4123123123zOn3MkhuVB"
}
},
"updatedBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "4123123123zOn3MkhuVB"
}
},
"publishedCounter": 3,
"version": 23,
"publishedBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "4123123123zOn3MkhuVB"
}
},
"contentType": {
"sys": {
"type": "Link",
"linkType": "ContentType",
"id": "hotelInfo"
}
}
},
"fields": {}
}
And in Contentful Admin area, all the fields of the post become empty.
Contentful documentation says:
Contentful doesn't merge changes made to content, so when updating
content, you need to send the entire body of an entry. If you update
content with a subset of properties, you will lose all existing
properties not included in that update.
You should always update resources in the following order:
Fetch current resource.
Make changes to the current resource.
Update the resource by passing the changed resource along with current version number.
This way no unseen changes are overridden and unexpected conflicts are
unlikely to occur.
Note: You can't update any of the sys property fields, including
sys.id.
...so, I guess, I'm doing everything right - taking the post, editing data and sending updated post back.
I tried editing my JSON data to send it without sys fields, but no luck.
I'm stuck, anyone has any ideas what should I proceed with?
Thanks to #whitep4nth3r I was able to solve the problem.
I needed to GET data from the same source I'm trying to PUT it to.
The Authorisation header needed to be replaced with the Personal access token used for PUT request.

Moving a JSON array which have another array elements to the same LEVEL

I have the following JSON which have an element array_within_array in another array. So I want to pull both array_within_array element and upper array element(event_array) to root level using jq.
So here there are 3 events.
meal_selection
login
placed_order
Event placed_order have two sub-events in array. So after conversion there should be 4 events(1 from meal_selection, 1 from login and 2 from placed_order). these all should be on the same level.
Here is the JSON
{
"region": "USA",
"user_id": "123",
"event_array": [{
"event_attributes": {
"date": "2021-08-17",
"category": "lunch",
"location": "office"
},
"event_name": "meal_selection",
"created_at": "2021-08-13 01:28:57"
},
{
"event_name": "login",
"created_at": "2021-08-13 01:29:02"
},
{
"event_attributes": {
"array_within_array": [
{
"date": "2021-08-17",
"category": "lunch",
"location": "office"
},
{
"date": "2021-08-18",
"category": "dinner",
"location": "home"
}
]
},
"event_name": "placed_order",
"created_at": "2021-08-13 01:28:08"
}
]
}
and I want to convert to the below one
{
"region": "USA",
"user_id": "123",
"event_attributes": {
"date": "2021-08-17",
"category": "lunch",
"location": "office"
},
"event_name": "meal_selection",
"created_at": "2021-08-13 01:28:57"
}
{
"region": "USA",
"user_id": "123",
"event_name": "login",
"created_at": "2021-08-13 01:29:02"
}
{
"region": "USA",
"user_id": "123",
"event_attributes": {
"date": "2021-08-17",
"category": "lunch",
"location": "office"
},
"event_name": "placed_order",
"created_at": "2021-08-13 01:28:08"
}
{
"region": "USA",
"user_id": "123",
"event_attributes": {
"date": "2021-08-18",
"category": "dinner",
"location": "home"
},
"event_name": "placed_order",
"created_at": "2021-08-13 01:28:08"
}
Here's a straightforward solution that keeps things simple by using two steps:
{ region, user_id} + (.event_array[] )
| if .event_attributes|has("array_within_array")
then .event_attributes.array_within_array as $a
| .event_attributes = $a[]
else .
end

Receiving multiple webhook notifications for every Office 365 event update

I'm working on a sync server that keeps the Office 365 events and my calendering app in sync
I subscribed to a push notification for user's event calendar that has the following custom single extended property.
Sample subscription request payload
{
"resource": "/me/events?$expand=singleValueExtendedProperties($filter=id%20eq%20'\''String%20{66f5a359-4659-4830-9070-00047ec6ac6e}%20Name%20CUSTOM'\'')",
"notificationUrl": "https://serverurl.xxxx.com/dev/notification",
"changeType": "updated,created",
"clientState": "123456-fad3-4191-9a66-123456789",
"expirationDateTime": "2018-03-17T11:00:00.0000000Z"
}
Then I do a single update of calendar event that has the above custom single extended property. On update, the sync server receives multiple notifications (2-3 notifications) for just updating the title of the event.
Notification 1:
{
"value": [{
"subscriptionId": "9645fed8-dc53-4955-b3a1-2d2b9ac5728f",
"subscriptionExpirationDateTime": "2018-03-17T11:00:00+00:00",
"changeType": "updated",
"resource": "<masked>",
"resourceData": {
"#odata.type": "#Microsoft.Graph.Event",
"#odata.id": "<masked>",
"#odata.etag": "W/\"+JK7q7qG1U+aBgDQ2ypjIQAAVnP6yQ==\"",
"id": "AAMkAGJmZjA5NzI0LWM5NTgtNGRhYy04MDExLTJmZTY4ZTJkNmVlYQBGAAAAAAC-F40EZzuzSqgA9N8VQW0zBwD4kruruobVT5oGANDbKmMhAAAAAAENAAD4kruruobVT5oGANDbKmMhAABV-OaMAAA=",
"createdDateTime": "2018-03-13T13:30:54.740501Z",
"lastModifiedDateTime": "2018-03-13T13:42:33.7107864Z",
"changeKey": "+JK7q7qG1U+aBgDQ2ypjIQAAVnP6yQ==",
"categories": [],
"originalStartTimeZone": "Pacific Standard Time",
"originalEndTimeZone": "Pacific Standard Time",
"iCalUId": "040000008200E00074C5B7101A82E0080000000006474883CFBAD30100000000000000001000000021D57F3032480543BE96AE56D8816FDF",
"reminderMinutesBeforeStart": 15,
"isReminderOn": true,
"hasAttachments": false,
"subject": "Microsoft DEMO - 2 UPDATED",
"bodyPreview": "Let's get together!",
"importance": "Normal",
"sensitivity": "Normal",
"isAllDay": false,
"isCancelled": false,
"isOrganizer": true,
"responseRequested": true,
"seriesMasterId": null,
"showAs": "Busy",
"type": "SingleInstance",
"webLink": "<masked>",
"onlineMeetingUrl": null,
"responseStatus": {
"Response": "Organizer",
"Time": "0001-01-01T00:00:00Z"
},
"body": {
"ContentType": "HTML",
"Content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta content=\"text/html; charset=us-ascii\">\r\n</head>\r\n<body>\r\nLet's get together!\r\n</body>\r\n</html>\r\n"
},
"start": {
"DateTime": "2018-03-29T01:00:00Z",
"TimeZone": "tzone://Microsoft/Utc"
},
"end": {
"DateTime": "2018-03-29T06:00:00Z",
"TimeZone": "tzone://Microsoft/Utc"
},
"location": {
"DisplayName": "",
"LocationType": "Default",
"UniqueIdType": "Unknown",
"Address": {
"Type": "Unknown"
},
"Coordinates": {}
},
"locations": [],
"recurrence": null,
"attendees": [{
"Type": "Required",
"Status": {
"Response": "None",
"Time": "0001-01-01T00:00:00Z"
},
"EmailAddress": {
"Name": "<masked>",
"Address": "<masked>"
}
}],
"organizer": {
"EmailAddress": {
"Name": "<masked>",
"Address": "<masked>"
}
}
},
"clientState": "123456-fad3-4191-9a66-123456789"
}]
}
Notification 2:
{
"value": [{
"subscriptionId": "9645fed8-dc53-4955-b3a1-2d2b9ac5728f",
"subscriptionExpirationDateTime": "2018-03-17T11:00:00+00:00",
"changeType": "updated",
"resource": "<masked>",
"resourceData": {
"#odata.type": "#Microsoft.Graph.Event",
"#odata.id": "<masked>",
"#odata.etag": "W/\"+JK7q7qG1U+aBgDQ2ypjIQAAVnP6yw==\"",
"id": "AAMkAGJmZjA5NzI0LWM5NTgtNGRhYy04MDExLTJmZTY4ZTJkNmVlYQBGAAAAAAC-F40EZzuzSqgA9N8VQW0zBwD4kruruobVT5oGANDbKmMhAAAAAAENAAD4kruruobVT5oGANDbKmMhAABV-OaMAAA=",
"createdDateTime": "2018-03-13T13:30:54.740501Z",
"lastModifiedDateTime": "2018-03-13T13:42:33.869926Z",
"changeKey": "+JK7q7qG1U+aBgDQ2ypjIQAAVnP6yw==",
"categories": [],
"originalStartTimeZone": "Pacific Standard Time",
"originalEndTimeZone": "Pacific Standard Time",
"iCalUId": "<masked>",
"reminderMinutesBeforeStart": 15,
"isReminderOn": true,
"hasAttachments": false,
"subject": "Microsoft DEMO - 2 UPDATED",
"bodyPreview": "Let's get together!",
"importance": "Normal",
"sensitivity": "Normal",
"isAllDay": false,
"isCancelled": false,
"isOrganizer": true,
"responseRequested": true,
"seriesMasterId": null,
"showAs": "Busy",
"type": "SingleInstance",
"webLink": "<masked>",
"onlineMeetingUrl": null,
"responseStatus": {
"Response": "Organizer",
"Time": "0001-01-01T00:00:00Z"
},
"body": {
"ContentType": "HTML",
"Content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta content=\"text/html; charset=us-ascii\">\r\n</head>\r\n<body>\r\nLet's get together!\r\n</body>\r\n</html>\r\n"
},
"start": {
"DateTime": "2018-03-29T01:00:00Z",
"TimeZone": "tzone://Microsoft/Utc"
},
"end": {
"DateTime": "2018-03-29T06:00:00Z",
"TimeZone": "tzone://Microsoft/Utc"
},
"location": {
"DisplayName": "",
"LocationType": "Default",
"UniqueIdType": "Unknown",
"Address": {
"Type": "Unknown"
},
"Coordinates": {}
},
"locations": [],
"recurrence": null,
"attendees": [{
"Type": "Required",
"Status": {
"Response": "None",
"Time": "0001-01-01T00:00:00Z"
},
"EmailAddress": {
"Name": "<masked>",
"Address": "<masked>"
}
}],
"organizer": {
"EmailAddress": {
"Name": "<masked>",
"Address": "<masked>"
}
}
},
"clientState": "123456-fad3-4191-9a66-123456789"
}]
}
Notification 3:
{
"value": [{
"subscriptionId": "9645fed8-dc53-4955-b3a1-2d2b9ac5728f",
"subscriptionExpirationDateTime": "2018-03-17T11:00:00+00:00",
"changeType": "updated",
"resource": "<masked>",
"resourceData": {
"#odata.type": "#Microsoft.Graph.Event",
"#odata.id": "<masked>",
"#odata.etag": "W/\"+JK7q7qG1U+aBgDQ2ypjIQAAVnP6yw==\"",
"id": "AAMkAGJmZjA5NzI0LWM5NTgtNGRhYy04MDExLTJmZTY4ZTJkNmVlYQBGAAAAAAC-F40EZzuzSqgA9N8VQW0zBwD4kruruobVT5oGANDbKmMhAAAAAAENAAD4kruruobVT5oGANDbKmMhAABV-OaMAAA=",
"createdDateTime": "2018-03-13T13:30:54.740501Z",
"lastModifiedDateTime": "2018-03-13T13:42:33.869926Z",
"changeKey": "+JK7q7qG1U+aBgDQ2ypjIQAAVnP6yw==",
"categories": [],
"originalStartTimeZone": "Pacific Standard Time",
"originalEndTimeZone": "Pacific Standard Time",
"iCalUId": "<masked>",
"reminderMinutesBeforeStart": 15,
"isReminderOn": true,
"hasAttachments": false,
"subject": "Microsoft DEMO - 2 UPDATED",
"bodyPreview": "Let's get together!",
"importance": "Normal",
"sensitivity": "Normal",
"isAllDay": false,
"isCancelled": false,
"isOrganizer": true,
"responseRequested": true,
"seriesMasterId": null,
"showAs": "Busy",
"type": "SingleInstance",
"webLink": "<masked>",
"onlineMeetingUrl": null,
"responseStatus": {
"Response": "Organizer",
"Time": "0001-01-01T00:00:00Z"
},
"body": {
"ContentType": "HTML",
"Content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta content=\"text/html; charset=us-ascii\">\r\n</head>\r\n<body>\r\nLet's get together!\r\n</body>\r\n</html>\r\n"
},
"start": {
"DateTime": "2018-03-29T01:00:00Z",
"TimeZone": "tzone://Microsoft/Utc"
},
"end": {
"DateTime": "2018-03-29T06:00:00Z",
"TimeZone": "tzone://Microsoft/Utc"
},
"location": {
"DisplayName": "",
"LocationType": "Default",
"UniqueIdType": "Unknown",
"Address": {
"Type": "Unknown"
},
"Coordinates": {}
},
"locations": [],
"recurrence": null,
"attendees": [{
"Type": "Required",
"Status": {
"Response": "None",
"Time": "0001-01-01T00:00:00Z"
},
"EmailAddress": {
"Name": "<masked>",
"Address": "<masked>"
}
}],
"organizer": {
"EmailAddress": {
"Name": "<masked>",
"Address": "<masked>"
}
}
},
"clientState": "123456-fad3-4191-9a66-123456789"
}]
}
I expected just one notification for every update (In my case I just did an update on event title), but the server is receiving multiple notifications with just #odata.etag different in the notifications. Is this expected?
When making a change to any item, the server may need to perform several modifications on the item, as well as other related items behind the scenes. Each of these modifications would result in a notification. There also could be other entities that are listening to changes, and reacting to them, potentially causing further changes and hence more notifications on the item. So in short, there is no guarantee regarding the number of notifications that you may receive as a result of a single API call. That is specially true for high-level calendaring operations, which often involve complex workflows on the server.
In this case you can see that in fact you have received three different change keys, indicating that the item has been modified multiple times.

Use of ResultTemplate in vsts extension tasks

I created a task that talks to a REST API to retreive the values for 2 picklists.
Filling the first dropdown box works fine, when using just the jsonpath.
Based on the first picklist I'd like to retreive values of the second list.
I've tried some variations and I'm trying something like this:
The json which I receive in the first rest call is similar to:
{
"id": "45",
"href": "https://selfservice/api/configurations/45/",
"name": "Type",
"description": "",
"version": "0.0.4",
"attributes": [
{
"value": {
"sdk-object": {
"type": "ConfigurationElement",
"id": "56"
}
},
"type": "ConfigurationElement",
"name": "win"
},
{
"value": {
"sdk-object": {
"type": "ConfigurationElement",
"id": "57"
}
},
"type": "ConfigurationElement",
"name": "lin"
}
]
}
I try to show the attributes name in the list and need the id of the attribute in the second picklist.
I created the following datasourcebindings in the task.json. Of course, the targets exist in the task.
task.json:
{
"id": "GUID",
"name": "Spinup",
"friendlyName": "Create environment",
"description": "Starts Workflow to create an environment. ___ The following placeholders are created deplending on the template and can be used in the rest of the release:**XLDEnvironment** and **testAgentHostname**",
"category": "Deploy",
"author": "***",
"version": {
"Major": 0,
"Minor": 0,
"Patch": 33
},
"minimumAgentVersion": "1.95.3",
"inputs": [
{
"label": "Endpoint",
"name": "connectedServiceName",
"required": true,
"type": "connectedService:server",
"helpMarkDown": "endpoint to connect to."
},
{
"name": "stage",
"type": "string",
"label": "Stage",
"defaultValue": "$(Release.EnvironmentName)",
"required": true,
"helpMarkDown": "Stage of the release, default value is based on the pipeline."
},
{
"name": "releaseName",
"type": "string",
"label": "Environment name",
"defaultValue": "$(Release.ReleaseName)",
"required": true,
"helpMarkDown": "Name of the environment that will be created."
},
{
"name": "owner",
"type": "string",
"label": "Owner of the environment",
"defaultValue": "***",
"required": true,
"helpMarkDown": "It is common to use the initials of the product owner in this field. There has to be a valid AD user owner of each environment. This can also be set by using a variable through the pipeline."
},
{
"name": "group",
"type": "string",
"label": "Group of the owner",
"defaultValue": "",
"required": true,
"helpMarkDown": "group that owns the environment. groups can be requested by the infrastructure department. Example: ****"
},
{
"name": "platform",
"type": "pickList",
"label": "Platform (OS)",
"defaultValue": "",
"required": true,
"helpMarkDown": "Choose the type of the target platform."
},
{
"name": "size",
"type": "pickList",
"label": "Environment Template",
"defaultValue": "",
"required": true,
"helpMarkDown": "Size of the environment to create."
}
],
"dataSourceBindings": [
{
"dataSourceName": "GetCEPlatformType",
"endpointId": "$(connectedServiceName)",
"target": "platform",
"selector": "jsonpath:$.attributes[*].name",
"keySelector": "jsonpath:$.attributes[*].value.sdk-object.id"
},
{
"dataSourceName": "GetCEPlatformSize",
"endpointId": "$(connectedServiceName)",
"target": "size",
"parameters": {
"platformTypeId": "$(platform)"
}
}
],
"instanceNameFormat": "Spin up $(size) $(platform) environment",
"execution": {
"PowerShell3": {
"target": "$(currentDirectory)\\task.ps1",
"argumentFormat": "",
"workingDirectory": "$(currentDirectory)"
}
}
}
vss-extension.json:
{
"manifestVersion": 1,
"id": "*****",
"name": "Release Tasks",
"version": "1.0.1",
"publisher": "***",
"targets": [
{
"id": "Microsoft.VisualStudio.Services"
}
],
"description": "Tools to contact ***. Includes a task to spin up a platform and a task to remove the platform.",
"categories": [
"Build and release"
],
"icons": {
"default": "images/extension-icon.png"
},
"files": [
{
"path": "RemoveEnvironment"
},
{
"path": "SpinUpEnvironment"
}
],
"contributions": [
{
"id": "******",
"type": "ms.vss-distributed-task.task",
"targets": [
"ms.vss-distributed-task.tasks"
],
"properties": {
"name": "RemoveEnvironment"
}
},
{
"id": "*********",
"type": "ms.vss-distributed-task.task",
"targets": [
"ms.vss-distributed-task.tasks"
],
"properties": {
"name": "SpinUpEnvironment"
}
},
{
"description": "Service Endpoint type for all connections",
"id": "endpoint-type",
"properties": {
"authenticationSchemes": [
{
"inputDescriptors": [
{
"description": "Username",
"id": "username",
"inputMode": "textbox",
"name": "Username",
"validation": {
"dataType": "string",
"isRequired": true
}
},
{
"description": "Password",
"id": "password",
"inputMode": "passwordbox",
"isConfidential": true,
"name": "Password",
"validation": {
"dataType": "string",
"isRequired": false
}
}
],
"type": "ms.vss-endpoint.endpoint-auth-scheme-basic"
}
],
"dataSources": [
{
"endpointUrl": "api/configurations/*****/",
"name": "GetCEPlatformType",
"resultSelector": "jsonpath:$.attributes[*].name"
},
{
"endpointUrl": "api/configurations/$(platformTypeId)/",
"name": "GetCEPlatformSize",
"resultSelector": "jsonpath:$.attributes[*].name"
}
],
"displayName": "*****",
"helpMarkDown": "Enter the url and credentials to connect to the endpoint.",
"name": "server",
"url": {
"displayName": "Server URL",
"helpText": "Url for the server to connect to."
}
},
"targets": [
"ms.vss-endpoint.endpoint-types"
],
"type": "ms.vss-endpoint.service-endpoint-type"
}
]
}
Sadly I can't get this to work. The datasources exist in the endpoint, but I'm not sure what to do with the resultSelector.
Does anyone have an idea on how to get this to work? The documentation on this isn't too good.
I'm not familiar with mustache, but in the mustache test tool this seems to work.
Thoughts are appreciated!
Try with this in the first data source:
{
"dataSourceName": "dsList1",
"endpointId": "$(connectedServiceName)",
"target": "list1",
"selector": "jsonpath:$.attributes[*].name",
"keySelector": "jsonpath:$.attributes[*].value.sdk-object.id"
}
Update:
You were trying to use "platformTypeId" in vss-extension.json file while it was defined in task.json, this cause the error message you mentioned in the comment.
By the way, I just noticed that you are using "dataSourceBindings", then you cannot use "selector" and "KeySelector" to parse the result since they are used for "sourceDefinitions".
To achieve the feature you want with "dataSourceBindings", you can definition the endpoint url in the task.json directly instead of defining datasource in endpoint contribution.
So you can move the datasources section in the vss-extension.json file first, and then in the task.json file, change to following:
"dataSourceBindings": [
{
"endpointId": "$(connectedServiceName)",
"endpointURL": "api/configurations/*****/",
"target": "platform",
"resultselector": "jsonpath:$.attributes[*]",
"resultTemplate": "{ \"Value\" : \"{{{value.id}}}\", \"DisplayValue\" : \"{{{name}}}\" }"
},
{
"endpointId": "$(connectedServiceName)",
"endpointURL": "api/configurations/$(platformTypeId)/",
"target": "size"
}
],

Getting the album link from a list of albums with Facebook Graph

The json below is the response I get from the server for requesting /id/albums, but I want to use that data to get the link to the album that has all the pictures in json format. The "link" field provided is to the actual desktop site, but I need the json. How would I use the json data provided (below) to send a request to graph.facebook.com to get the pictures within the corresponding album in json format?
{
"data": [
{
"id": "150228731810007",
"from": {
"name": "James McMahon",
"id": "100004686423103"
},
"name": "Profile Pictures",
"link": "https://www.facebook.com/album.php?fbid=150228731810007&id=100004686423103&aid=1073741831",
"cover_photo": "150228735143340",
"count": 2,
"type": "profile",
"created_time": "2013-03-15T05:29:24+0000",
"updated_time": "2013-11-09T17:12:36+0000",
"can_upload": false
},
{
"id": "233767233456156",
"from": {
"name": "James McMahon",
"id": "100004686423103"
},
"name": "Mobile Uploads",
"link": "https://www.facebook.com/album.php?fbid=233767233456156&id=100004686423103&aid=1073741838",
"type": "mobile",
"created_time": "2013-11-09T17:12:30+0000",
"updated_time": "2013-11-09T17:12:30+0000",
"can_upload": false
},
{
"id": "206255352874011",
"from": {
"name": "James McMahon",
"id": "100004686423103"
},
"name": "Aug. 17th, 2013",
"description": "Day with some of the Family",
"link": "https://www.facebook.com/album.php?fbid=206255352874011&id=100004686423103&aid=1073741837",
"cover_photo": "206255402874006",
"count": 8,
"type": "normal",
"created_time": "2013-08-17T21:24:12+0000",
"updated_time": "2013-08-17T21:24:36+0000",
"can_upload": false,
"likes": {
"data": [
{
"id": "1774907390",
"name": "Ashley Carter"
},
{
"id": "646440613",
"name": "Mitzy Lanthier"
},
{
"id": "1801948293",
"name": "Calvin Carter"
},
{
"id": "100000653918655",
"name": "Kimberly Lane Lirette"
}
],
"paging": {
"cursors": {
"after": "MTAwMDAwNjUzOTE4NjU1",
"before": "MTc3NDkwNzM5MA=="
}
}
}
},
{
"id": "150230918476455",
"from": {
"name": "James McMahon",
"id": "100004686423103"
},
"name": "Cover Photos",
"link": "https://www.facebook.com/album.php?fbid=150230918476455&id=100004686423103&aid=1073741833",
"cover_photo": "202581716574708",
"count": 4,
"type": "cover",
"created_time": "2013-03-15T05:43:31+0000",
"updated_time": "2013-08-08T17:26:35+0000",
"can_upload": false
},
{
"id": "158017154364498",
"from": {
"name": "James McMahon",
"id": "100004686423103"
},
"name": "Timeline Photos",
"link": "https://www.facebook.com/album.php?fbid=158017154364498&id=100004686423103&aid=1073741834",
"cover_photo": "179650435534503",
"count": 10,
"type": "wall",
"created_time": "2013-04-07T14:04:04+0000",
"updated_time": "2013-06-12T23:28:45+0000",
"can_upload": false
},
{
"id": "178309025668644",
"from": {
"name": "James McMahon",
"id": "100004686423103"
},
"name": "U.S.Navy D.E.P.",
"description": "Was a pretty fun day. We were out there helping restore this World War 2 Destroyer.",
"link": "https://www.facebook.com/album.php?fbid=178309025668644&id=100004686423103&aid=1073741835",
"cover_photo": "178309055668641",
"count": 4,
"type": "normal",
"created_time": "2013-06-10T00:32:45+0000",
"updated_time": "2013-06-10T00:33:49+0000",
"can_upload": false,
"likes": {
"data": [
{
"id": "100000651398529",
"name": "Jennifer Manuel Hyatt"
},
{
"id": "1801948293",
"name": "Calvin Carter"
},
{
"id": "1522740127",
"name": "Bliss Reane Kinder"
}
],
"paging": {
"cursors": {
"after": "MTUyMjc0MDEyNw==",
"before": "MTAwMDAwNjUxMzk4NTI5"
}
}
}
},
{
"id": "150228468476700",
"from": {
"name": "James McMahon",
"id": "100004686423103"
},
"name": "Untitled Album",
"description": "03112013",
"link": "https://www.facebook.com/album.php?fbid=150228468476700&id=100004686423103&aid=1073741830",
"cover_photo": "150228475143366",
"count": 1,
"type": "normal",
"created_time": "2013-03-15T05:27:54+0000",
"updated_time": "2013-03-15T05:28:17+0000",
"can_upload": false
}
],
"paging": {
"cursors": {
"after": "MTUwMjI4NDY4NDc2NzAw",
"before": "MTUwMjI4NzMxODEwMDA3"
}
}
}
Response received in 237 ms
You have the id field- that's the album-id
So, you can create the link by yourself, just like this-
https://graph.facebook.com/<ALBUM-ID>/photos
from this you can fetch all the photos of a particular album (but remember that you'll need the access token- of-course)
https://graph.facebook.com/<ALBUM-ID>/photos?access_token=<ACCESS-TOKEN>