Flutter Map a custom JSON to Object - json

I want to get an image URL from WP REST API, I was retrieving my posts to a List
so getting featuredImageUrl was like this :
A)
//THIS GETS AN URL TO ATTACHMENT WHEN IM USING A LIST<DYNAMIC>
featuredMediaAtta = posts[index]["_embedded"]["wp:featuredmedia"][0]["source_url"],
result is a url of embedded attachment, I want the same results in B
B)
I had to changed to Object Model from list to List>
The post model is:
Post.fromMap(Map<String, dynamic> map) {
if (map == null) {
return;
}
...
//I can retrieve featured media id successfully
featuredMediaID = map['featured_media'];
// BUT HERE I CAN NOT RETURN THE ATTACHMENT URL
featuredMediaAtta = map["_embedded"]["wp:featuredmedia"][0]["source_url"] ;
commentStatus = map['comment_status'];
...
here is the JSON response for getting
http://www.ehawal.com/wp-json/wp/v2/posts/73335?_embed
{
"id": 73335,
"date": "2018-12-01T20:05:26",
"date_gmt": "2018-12-01T20:05:26",
"guid": {
"rendered": "http://www.theUrl.com/?p=73335"
},
"modified": "2018-12-01T20:05:26",
"modified_gmt": "2018-12-01T20:05:26",
"slug": "%d8%a8%d9%88-%d9%88%db%8e%d9%86%d9%87%e2%80%8c%db%8c-%d9%86%d9%88%db%8e",
"status": "publish",
"type": "post",
"link": "http://www.theUrl.com/2018/12/01/%d8%a8%d9%88-%d9%88%db%8e%d9%86%d9%87%e2%80%8c%db%8c-%d9%86%d9%88%db%8e/",
"title": {
"rendered": "بو وێنه\u200cی نوێ"
},
"content": {
"rendered": "<p>وێمه\u200cی لكسادژڤ ؛لكژ اعس</p>\n<div class=\"theUrl_container\"
"protected": false
},
"excerpt": {
"rendered": "<p>وێمه\u200cی لكسادژڤ ؛لكژ اعس</p>\n<div class=\"theUrl_container\" style=\"\"><!-- theUrl.com BEGIN --><span class=\"theUrl-wrapper\"
"author": 1,
"featured_media": 73336,
"comment_status": "open",
"ping_status": "open",
"sticky": false,
"template": "",
"format": "standard",
"meta": [],
"categories": [
195,
1,
176
],
"tags": [],
"acf": [],
"_links": {
"self": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/posts/73335"
}
],
"collection": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/posts"
}
],
"about": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/types/post"
}
],
"author": [
{
"embeddable": true,
"href": "http://www.theUrl.com/wp-json/wp/v2/users/1"
}
],
"replies": [
{
"embeddable": true,
"href": "http://www.theUrl.com/wp-json/wp/v2/comments?post=73335"
}
],
"version-history": [
{
"count": 1,
"href": "http://www.theUrl.com/wp-json/wp/v2/posts/73335/revisions"
}
],
"predecessor-version": [
{
"id": 73337,
"href": "http://www.theUrl.com/wp-json/wp/v2/posts/73335/revisions/73337"
}
],
"wp:featuredmedia": [
{
"embeddable": true,
"href": "http://www.theUrl.com/wp-json/wp/v2/media/73336"
}
],
"wp:attachment": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/media?parent=73335"
}
],
"wp:term": [
{
"taxonomy": "category",
"embeddable": true,
"href": "http://www.theUrl.com/wp-json/wp/v2/categories?post=73335"
},
{
"taxonomy": "post_tag",
"embeddable": true,
"href": "http://www.theUrl.com/wp-json/wp/v2/tags?post=73335"
}
],
"curies": [
{
"name": "wp",
"href": "https://api.w.org/{rel}",
"templated": true
}
]
},
"_embedded": {
"author": [
{
"id": 1,
"name": "hooshyar_nuc",
"url": "",
"description": "",
"link": "http://www.theUrl.com/author/hooshyar_nuc/",
"slug": "hooshyar_nuc",
"avatar_urls": {
"24": "http://0.gravatar.com/avatar/f1a624f625d4271d52b7fc9445609eb5?s=24&d=mm&r=g",
"48": "http://0.gravatar.com/avatar/f1a624f625d4271d52b7fc9445609eb5?s=48&d=mm&r=g",
"96": "http://0.gravatar.com/avatar/f1a624f625d4271d52b7fc9445609eb5?s=96&d=mm&r=g"
},
"acf": [],
"_links": {
"self": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/users/1"
}
],
"collection": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/users"
}
]
}
}
],
"wp:featuredmedia": [
{
"id": 73336,
"date": "2018-12-01T20:05:10",
"slug": "guardian",
"type": "attachment",
"link": "http://www.theUrl.com/2018/12/01/%d8%a8%d9%88-%d9%88%db%8e%d9%86%d9%87%e2%80%8c%db%8c-%d9%86%d9%88%db%8e/guardian/",
"title": {
"rendered": "guardian"
},
"author": 1,
"acf": [],
"caption": {
"rendered": ""
},
"alt_text": "",
"media_type": "image",
"mime_type": "image/png",
"media_details": {
"width": 400,
"height": 155,
"file": "2018/12/guardian.png",
"sizes": {
"thumbnail": {
"file": "guardian-150x150.png",
"width": 150,
"height": 150,
"mime_type": "image/png",
"source_url": "http://www.theUrl.com/wp-content/uploads/2018/12/guardian-150x150.png"
},
"medium": {
"file": "guardian-300x116.png",
"width": 300,
"height": 116,
"mime_type": "image/png",
"source_url": "http://www.theUrl.com/wp-content/uploads/2018/12/guardian-300x116.png"
},
"tie-small": {
"file": "guardian-110x75.png",
"width": 110,
"height": 75,
"mime_type": "image/png",
"source_url": "http://www.theUrl.com/wp-content/uploads/2018/12/guardian-110x75.png"
},
"tie-medium": {
"file": "guardian-310x155.png",
"width": 310,
"height": 155,
"mime_type": "image/png",
"source_url": "http://www.theUrl.com/wp-content/uploads/2018/12/guardian-310x155.png"
},
"tie-large": {
"file": "guardian-310x155.png",
"width": 310,
"height": 155,
"mime_type": "image/png",
"source_url": "http://www.theUrl.com/wp-content/uploads/2018/12/guardian-310x155.png"
},
"full": {
"file": "guardian.png",
"width": 400,
"height": 155,
"mime_type": "image/png",
"source_url": "http://www.theUrl.com/wp-content/uploads/2018/12/guardian.png"
}
},
"image_meta": {
"aperture": "0",
"credit": "",
"camera": "",
"caption": "",
"created_timestamp": "0",
"copyright": "",
"focal_length": "0",
"iso": "0",
"shutter_speed": "0",
"title": "",
"orientation": "0",
"keywords": []
}
},
"source_url": "http://www.theUrl.com/wp-content/uploads/2018/12/guardian.png",
"_links": {
"self": [
{
"attributes": [],
"href": "http://www.theUrl.com/wp-json/wp/v2/media/73336"
}
],
"collection": [
{
"attributes": [],
"href": "http://www.theUrl.com/wp-json/wp/v2/media"
}
],
"about": [
{
"attributes": [],
"href": "http://www.theUrl.com/wp-json/wp/v2/types/attachment"
}
],
"author": [
{
"attributes": {
"embeddable": true
},
"href": "http://www.theUrl.com/wp-json/wp/v2/users/1"
}
],
"replies": [
{
"attributes": {
"embeddable": true
},
"href": "http://www.theUrl.com/wp-json/wp/v2/comments?post=73336"
}
]
}
}
],
"wp:term": [
[
{
"id": 195,
"link": "http://www.theUrl.com/category/world/",
"name": "جیهان",
"slug": "world",
"taxonomy": "category",
"acf": [],
"_links": {
"self": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/categories/195"
}
],
"collection": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/categories"
}
],
"about": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/taxonomies/category"
}
],
"wp:post_type": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/posts?categories=195"
}
],
"curies": [
{
"name": "wp",
"href": "https://api.w.org/{rel}",
"templated": true
}
]
}
},
{
"id": 1,
"link": "http://www.theUrl.com/category/all/",
"name": "سه\u200cره\u200cكی",
"slug": "all",
"taxonomy": "category",
"acf": [],
"_links": {
"self": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/categories/1"
}
],
"collection": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/categories"
}
],
"about": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/taxonomies/category"
}
],
"wp:post_type": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/posts?categories=1"
}
],
"curies": [
{
"name": "wp",
"href": "https://api.w.org/{rel}",
"templated": true
}
]
}
},
{
"id": 176,
"link": "http://www.theUrl.com/category/grng/",
"name": "گرنگ",
"slug": "grng",
"taxonomy": "category",
"acf": [],
"_links": {
"self": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/categories/176"
}
],
"collection": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/categories"
}
],
"about": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/taxonomies/category"
}
],
"wp:post_type": [
{
"href": "http://www.theUrl.com/wp-json/wp/v2/posts?categories=176"
}
],
"curies": [
{
"name": "wp",
"href": "https://api.w.org/{rel}",
"templated": true
}
]
}
}
],
[]
]
}
}

Related

Connecting conversational AI to Alexa

I built my Conversational AI chatbot and followed all the steps to connect it to Alexa but when I try to call my chatbot in alexa simulator,I get the following message:
"There was a problem with the requested skill's response"
this is the code which appears on JSON output 1 and JSON output 2 after the error:
{
"version": "1.0",
"session": {
"new": true,
"sessionId": "amzn1.echo-api.session.5e3bb3da-ba51-4422-80cb-c5cace7e3756",
"application": {
"applicationId": "amzn1.ask.skill.bfb81ac5-d463-4201-b70c-a35f8cc6dbed"
},
"user": {
"userId": "amzn1.ask.account.AHIAWE37M4SE4Q7DBFIIRLYZYXFKPU42HAD35P5XLHMZA4RGRXFERFRKPAN2I34A56TCC2XEGVNKYH7SW2KVB2NBUYAAY73GRDDXNEFFFY46W2FJXXCLSMAIUWDEUESU3ZMGIYPPYA2WXFXBBHGJBLHNVRYBLXTBLOCJMGOMK4VXNONXGGICYKBBIE7LMCTSUOVEYRAS3E2ATNQ"
}
},
"context": {
"System": {
"application": {
"applicationId": "amzn1.ask.skill.bfb81ac5-d463-4201-b70c-a35f8cc6dbed"
},
"user": {
"userId": "amzn1.ask.account.AHIAWE37M4SE4Q7DBFIIRLYZYXFKPU42HAD35P5XLHMZA4RGRXFERFRKPAN2I34A56TCC2XEGVNKYH7SW2KVB2NBUYAAY73GRDDXNEFFFY46W2FJXXCLSMAIUWDEUESU3ZMGIYPPYA2WXFXBBHGJBLHNVRYBLXTBLOCJMGOMK4VXNONXGGICYKBBIE7LMCTSUOVEYRAS3E2ATNQ"
},
"device": {
"deviceId": "amzn1.ask.device.AHAUYPX373VS2JXBI2E5VG4GPJPAUT5I5KRINQVJCDM7C7MZFGHWSEQV6CKKSHEZQT7HRAIAHS5BRCKLRHDDRTOE3XYWTDOSIW4MKRXAEGZIWA6XQTXY7TRC26PTPZWWB5T6D77XQ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lSWQiOiJhbXpuMS5hc2suZGV2aWNlLkFIQVVZUFgzNzNWUzJKWEJJMkU1Vkc0R1BKUEFVVDVJNUtSSU5RVkpDRE03QzdNWkZHSFdTRVFWNkNLS1NIRVpRVDdIUkFJQUhTNUJSQ0tMUkhERFJUT0UzWFlXVERPU0lXNE1LUlhBRUdaSVdBNlhRVFhZN1RSQzI2UFRQWldXQjVUNkQ3N1hRTkRUUExVVEtSQk9DSjJLTENDWVJCVU1YTEQyR0xLVTRLMk9RWEhKREFNNFEiLCJ1c2VySWQiOiJhbXpuMS5hc2suYWNjb3VudC5BSElBV0UzN000U0U0UTdEQkZJSVJMWVpZWEZLUFU0MkhBRDM1UDVYTEhNWkE0UkdSWEZFUkZSS1BBTjJJMzRBNTZUQ0MyWEVHVk5LWUg3U1cyS1ZCMk5CVVlBQVk3M0dSRERYTkVGRkZZNDZXMkZKWFhDTFNNQUlVV0RFVUVTVTNaTUdJWVBQWUEyV1hGWEJCSEdKQkxITlZSWUJMWFRCTE9DSk1HT01LNFZYTk9OWEdHSUNZS0JCSUU3TE1DVFNVT1ZFWVJBUzNFMkFUTlEifX0.UV1qiib5UAV4msb27bxN6zBtPnaYg_1ifwWQhuSXNQpDUzM8dQlo29T5O425Itz6M-xufZT5wtJpk-mT2JZUWjdAe8bquTT9YAmAroAp3_Sa-OJ1iXP8qhiPQeu8g7Xwl2XVpFUAuaeqoSyZxzM2dnKBIND18qrcDfDTS9YRzwcrQdBaGlH-_uW0nXDOntyZ7myqB50fBVtlz5xiayHFE5J3-OTaMK4nuggMKzuL8lbYQrcEPwwbt940LiKy4CRjltHA83N1xtyBtkafcOFQPN3UAzFKPI85jUtIFuYUsuIbl7N_f64yOAgtkIQEvjCA-DWQzkerPyHJo2VrF0q7Tw"
},
"Viewport": {
"experiences": [
{
"arcMinuteWidth": 246,
"arcMinuteHeight": 144,
"canRotate": false,
"canResize": false
}
],
"shape": "RECTANGLE",
"pixelWidth": 1024,
"pixelHeight": 600,
"dpi": 160,
"currentPixelWidth": 1024,
"currentPixelHeight": 600,
"touch": [
"SINGLE"
],
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
}
},
"Viewports": [
{
"type": "APL",
"id": "main",
"shape": "RECTANGLE",
"dpi": 160,
"presentationType": "STANDARD",
"canRotate": false,
"configuration": {
"current": {
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
},
"size": {
"type": "DISCRETE",
"pixelWidth": 1024,
"pixelHeight": 600
}
}
}
}
]
},
"request": {
"type": "LaunchRequest",
"requestId": "amzn1.echo-api.request.1d812f0b-5bce-42a6-bdd5-4791d5876e8e",
"timestamp": "2020-01-22T09:20:12Z",
"locale": "en-US",
"shouldLinkResultBeReturned": false
}}
JSON Output 2:
{
"version": "1.0",
"session": {
"new": false,
"sessionId": "amzn1.echo-api.session.5e3bb3da-ba51-4422-80cb-c5cace7e3756",
"application": {
"applicationId": "amzn1.ask.skill.bfb81ac5-d463-4201-b70c-a35f8cc6dbed"
},
"user": {
"userId": "amzn1.ask.account.AHIAWE37M4SE4Q7DBFIIRLYZYXFKPU42HAD35P5XLHMZA4RGRXFERFRKPAN2I34A56TCC2XEGVNKYH7SW2KVB2NBUYAAY73GRDDXNEFFFY46W2FJXXCLSMAIUWDEUESU3ZMGIYPPYA2WXFXBBHGJBLHNVRYBLXTBLOCJMGOMK4VXNONXGGICYKBBIE7LMCTSUOVEYRAS3E2ATNQ"
}
},
"context": {
"System": {
"application": {
"applicationId": "amzn1.ask.skill.bfb81ac5-d463-4201-b70c-a35f8cc6dbed"
},
"user": {
"userId": "amzn1.ask.account.AHIAWE37M4SE4Q7DBFIIRLYZYXFKPU42HAD35P5XLHMZA4RGRXFERFRKPAN2I34A56TCC2XEGVNKYH7SW2KVB2NBUYAAY73GRDDXNEFFFY46W2FJXXCLSMAIUWDEUESU3ZMGIYPPYA2WXFXBBHGJBLHNVRYBLXTBLOCJMGOMK4VXNONXGGICYKBBIE7LMCTSUOVEYRAS3E2ATNQ"
},
"device": {
"deviceId":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CA-DWQzkerPyHJo2VrF0q7Tw"
},
"Viewport": {
"experiences": [
{
"arcMinuteWidth": 246,
"arcMinuteHeight": 144,
"canRotate": false,
"canResize": false
}
],
"shape": "RECTANGLE",
"pixelWidth": 1024,
"pixelHeight": 600,
"dpi": 160,
"currentPixelWidth": 1024,
"currentPixelHeight": 600,
"touch": [
"SINGLE"
],
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
}
},
"Viewports": [
{
"type": "APL",
"id": "main",
"shape": "RECTANGLE",
"dpi": 160,
"presentationType": "STANDARD",
"canRotate": false,
"configuration": {
"current": {
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
},
"size": {
"type": "DISCRETE",
"pixelWidth": 1024,
"pixelHeight": 600
}
}
}
}
]
},
"request": {
"type": "SessionEndedRequest",
"requestId": "amzn1.echo-api.request.30c39df8-dc26-4dcf-a193-de432a3a0ab1",
"timestamp": "2020-01-22T09:20:13Z",
"locale": "en-US",
"reason": "ERROR",
"error": {
"type": "INVALID_RESPONSE",
"message": "An exception occurred while dispatching the request to the skill."
}
}}{
"body": {
"version": "1.0",
"response": {
"type": "_DEFAULT_RESPONSE"
},
"sessionAttributes": {},
"userAgent": "ask-node/2.7.0 Node/v8.15.0"
}
}

curl get is omitting json that is shown in the browser

I'm working with the confluence API and testing some endpoints in the browser to make sure it returns the right information and then fetching with curl.
When I go to the following url:
http://localhost:8090/rest/api/content/search?cql=label+%3D+%22program-status-rollup-employee%22&expand=space
I get the following JSON:
{
"results": [
{
"id": "2064397",
"type": "page",
"status": "current",
"title": "TL Employee Reports",
"space": {
"id": 98306,
"key": "COM",
"name": "Compass",
"type": "global",
"_expandable": {
"metadata": "",
"icon": "",
"description": "",
"homepage": "/rest/api/content/65584"
},
"_links": {
"self": "http://localhost:8090/rest/api/space/COM",
"webui": "/display/COM"
}
},
"extensions": {
"position": "none"
},
"_expandable": {
"container": "/rest/api/space/COM",
"metadata": "",
"operations": "",
"children": "/rest/api/content/2064397/child",
"restrictions": "/rest/api/content/2064397/restriction/byOperation",
"history": "/rest/api/content/2064397/history",
"ancestors": "",
"body": "",
"version": "",
"descendants": "/rest/api/content/2064397/descendant"
},
"_links": {
"self": "http://localhost:8090/rest/api/content/2064397",
"webui": "/display/COM/TL+Employee+Reports",
"edit": "/pages/resumedraft.action?draftId=2064397&draftShareId=0906da34-3930-4c15-8339-d85c309f6cc0",
"tinyui": "/x/DYAf"
}
},
{
"id": "2064402",
"type": "page",
"status": "current",
"title": "Employee Reports",
"space": {
"id": 2162689,
"key": "NC",
"name": "New Compass",
"type": "global",
"_expandable": {
"metadata": "",
"icon": "",
"description": "",
"homepage": "/rest/api/content/2064389"
},
"_links": {
"self": "http://localhost:8090/rest/api/space/NC",
"webui": "/display/NC"
}
},
"extensions": {
"position": "none"
},
"_expandable": {
"container": "/rest/api/space/NC",
"metadata": "",
"operations": "",
"children": "/rest/api/content/2064402/child",
"restrictions": "/rest/api/content/2064402/restriction/byOperation",
"history": "/rest/api/content/2064402/history",
"ancestors": "",
"body": "",
"version": "",
"descendants": "/rest/api/content/2064402/descendant"
},
"_links": {
"self": "http://localhost:8090/rest/api/content/2064402",
"webui": "/display/NC/Employee+Reports",
"edit": "/pages/resumedraft.action?draftId=2064402&draftShareId=8fb3e862-e52f-498d-83d5-6b6046682070",
"tinyui": "/x/EoAf"
}
},
{
"id": "819224",
"type": "page",
"status": "current",
"title": "Employee Reports",
"space": {
"id": 98306,
"key": "COM",
"name": "Compass",
"type": "global",
"_expandable": {
"metadata": "",
"icon": "",
"description": "",
"homepage": "/rest/api/content/65584"
},
"_links": {
"self": "http://localhost:8090/rest/api/space/COM",
"webui": "/display/COM"
}
},
"extensions": {
"position": "none"
},
"_expandable": {
"container": "/rest/api/space/COM",
"metadata": "",
"operations": "",
"children": "/rest/api/content/819224/child",
"restrictions": "/rest/api/content/819224/restriction/byOperation",
"history": "/rest/api/content/819224/history",
"ancestors": "",
"body": "",
"version": "",
"descendants": "/rest/api/content/819224/descendant"
},
"_links": {
"self": "http://localhost:8090/rest/api/content/819224",
"webui": "/display/COM/Employee+Reports",
"edit": "/pages/resumedraft.action?draftId=819224&draftShareId=0df4eb62-9bb6-4532-a445-4002695dcb90",
"tinyui": "/x/GIAM"
}
}
],
"start": 0,
"limit": 25,
"size": 3,
"_links": {
"base": "http://localhost:8090",
"context": "",
"self": "http://localhost:8090/rest/api/content/search?expand=space&cql=label+%3D+%22program-status-rollup-employee%22"
}
}
But when I get the same endpoint via curl:
curl -u $user:$password http://localhost:8090/rest/api/content/search?cql=label+%3D+%22program-status-rollup-employee%22&expand=space
I don't get all of the information:
{
"results":[
{
"id":"2064397",
"type":"page",
"status":"current",
"title":"TL Employee Reports",
"restrictions":{
},
"_expandable":{
"container":"",
"metadata":"",
"extensions":"",
"operations":"",
"children":"",
"history":"/rest/api/content/2064397/history",
"ancestors":"",
"body":"",
"version":"",
"descendants":"",
"space":"/rest/api/space/COM"
},
"_links":{
"self":"http://localhost:8090/rest/api/content/2064397",
"webui":"/display/COM/TL+Employee+Reports",
"tinyui":"/x/DYAf"
}
},
{
"id":"2064402",
"type":"page",
"status":"current",
"title":"Employee Reports",
"restrictions":{
},
"_expandable":{
"container":"",
"metadata":"",
"extensions":"",
"operations":"",
"children":"",
"history":"/rest/api/content/2064402/history",
"ancestors":"",
"body":"",
"version":"",
"descendants":"",
"space":"/rest/api/space/NC"
},
"_links":{
"self":"http://localhost:8090/rest/api/content/2064402",
"webui":"/display/NC/Employee+Reports",
"tinyui":"/x/EoAf"
}
},
{
"id":"819224",
"type":"page",
"status":"current",
"title":"Employee Reports",
"restrictions":{
},
"_expandable":{
"container":"",
"metadata":"",
"extensions":"",
"operations":"",
"children":"",
"history":"/rest/api/content/819224/history",
"ancestors":"",
"body":"",
"version":"",
"descendants":"",
"space":"/rest/api/space/COM"
},
"_links":{
"self":"http://localhost:8090/rest/api/content/819224",
"webui":"/display/COM/Employee+Reports",
"tinyui":"/x/GIAM"
}
}
],
"start":0,
"limit":25,
"size":3,
"_links":{
"base":"http://localhost:8090",
"context":"",
"self":"http://localhost:8090/rest/api/content/search?cql=label+%3D+%22program-status-rollup-employee%22"
}
}
Specifically it omits the space object, which I need. Any thoughts?
I needed to escape the ampersand with single quotes. Once I did that, it returned the json that I saw in the browser
http://localhost:8090/rest/api/content/search?cql=label+%3D+%22program-status-rollup-employee%22'&'expand=space

Reading hierarchy of a JSON using value

I want to get the hierarchy of a JSON using a value. For example: In below JSON for value "Medical record number" , the desired information is "resource->identifier->type->coding->display" . IS their any inbuilt function to do so.
The one way to look for opening and ending braces to locate nodes. Any other efficient way ?
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"fullUrl": "Patient/996-756-495-101",
"resource": {
"resourceType": "Patient",
"id": "996-756-495-101",
"identifier": [
{
"type": {
"coding": [
{
"system": "http://hl7.org/fhir/v2/0203",
"code": "MR",
"display": "Medical record number"
}
]
},
"system": "https://www.lumc.nl",
"value": "996-756-495-101"
}
],
"name": [
{
"use": "usual",
"family": [
"Levin_4"
],
"given": [
"Henry_4"
]
}
],
"gender": "male",
"birthDate": "1932-09-24",
"maritalStatus": {
"coding": [
{}
]
},
"managingOrganization": {
"reference": "Organization/12"
}
},
"request": {
"method": "POST",
"url": "Patient",
"ifNoneExist": "identifier=https://www.lumc.nl|996-756-495-101"
}
},
{
"fullUrl": "FamilyMemberHistory/d42ebf70-5c89-11db-b0de-0800200c9a66",
"resource": {
"resourceType": "FamilyMemberHistory",
"id": "d42ebf70-5c89-11db-b0de-0800200c9a66",
"patient": {
"reference": "Patient/996-756-495-101"
},
"status": "Partial",
"relationship": {
"coding": [
{
"system": "http://hl7.org/fhir/ValueSet/v3-FamilyMember",
"code": "FTH",
"display": "Father"
}
],
"text": "Father"
},
"gender": "male",
"bornDate": "1912",
"deceasedBoolean": true
},
"request": {
"method": "POST",
"url": "FamilyMemberHistory"
}
},
{
"fullUrl": "FamilyMemberHistory/a13c6160-5c8b-11db-b0de-0800200c9a66",
"resource": {
"resourceType": "FamilyMemberHistory",
"id": "a13c6160-5c8b-11db-b0de-0800200c9a66",
"patient": {
"reference": "Patient/996-756-495-101"
},
"status": "Partial",
"relationship": {
"coding": [
{
"system": "http://hl7.org/fhir/ValueSet/v3-FamilyMember",
"code": "MTH",
"display": "Mother"
}
],
"text": "Mother"
},
"gender": "female",
"bornDate": "1912",
"deceasedBoolean": false
},
"request": {
"method": "POST",
"url": "FamilyMemberHistory"
}
}
]
}

Drupal 7 Feed Import

I am now struggling for hours but I cannot get my feed import to run properly.
The strange is, that I can import data for the normal fields in Drupal like "Title" or "Language" or "User". But for my custom fields like "field_produkt_beschreibung", no entries are made in Drupal. Even if I supply a Standard Value for the field:
The standard value is not saved in the node.
{
"entity": "node",
"settings": {
"uniq_path": "SKU",
"preprocess": "",
"feed": {
"protect_on_invalid_source": 0,
"protect_on_fewer_items": "0"
},
"processor": {
"name": "default",
"class": "FeedImportProcessor",
"options": {
"items_count": "0",
"skip_imported": 0,
"updates_only": 0,
"reset_cache": "0",
"throw_exception": 1,
"max_reported_errors": "100",
"break_on_undefined_filter": 0,
"skip_defined_functions_check": 0,
"uniq_callback": "",
"after_save": "",
"before_combine": "",
"after_combine": "",
"before_create": "",
"before_save": ""
}
},
"reader": {
"name": "sql",
"class": "SQLFIReader",
"options": {
"dsn": "mysql:dbname=d****7;host=localhost",
"user": "d******7",
"pass": "*****",
"query": "SELECT * FROM mytable",
"params": ""
}
},
"hashes": {
"name": "sql",
"class": "FeedImportSQLHashes",
"options": {
"ttl": 0,
"insert_chunk": 300,
"update_chunk": 300,
"group": "produkte_h_lter"
}
},
"filter": {
"name": "default",
"class": "FeedImportMultiFilter",
"options": {
"param": "[field]",
"include": ""
}
},
"fields": {
"title": {
"field": "title",
"column": false,
"paths": [
"Produktname"
],
"default_action": 0,
"default_value": "Standardwert",
"update_mode": 0,
"filters": {
"\u00fc": {
"function": "FeedImportFilter::replace",
"params": [
"[field]",
"ü",
"\u00fc",
"1"
]
},
"\u00e4": {
"function": "FeedImportFilter::replace",
"params": [
"[field]",
"ä",
"\u00e4",
"1"
]
},
"\u00d6": {
"function": "FeedImportFilter::replace",
"params": [
"[field]",
"Ö",
"\u00d6",
"1"
]
},
"\u00f6": {
"function": "FeedImportFilter::replace",
"params": [
"[field]",
"ö",
"\u00f6",
"1"
]
},
"\u00df": {
"function": "FeedImportFilter::replace",
"params": [
"[field]",
"ß",
"\u00df",
"1"
]
},
"R": {
"function": "FeedImportFilter::replace",
"params": [
"[field]",
"®",
" ",
"1"
]
}
},
"prefilters": []
},
"field_produkt_hersteller_raw": {
"field": "field_produkt_hersteller_raw",
"column": true,
"paths": [
"//Hersteller"
],
"default_action": 0,
"default_value": "kein Hersteller",
"update_mode": 0,
"filters": [],
"prefilters": []
},
"field_produkt_link": {
"field": "field_produkt_link",
"column": true,
"paths": [
"Link"
],
"default_action": 0,
"default_value": "Standard",
"update_mode": 0,
"filters": [],
"prefilters": []
},
"field_produkt_artikelnummer": {
"field": "field_produkt_artikelnummer",
"column": true,
"paths": [
"Artikelnummer"
],
"default_action": 0,
"default_value": "Standardwert",
"update_mode": 0,
"filters": [],
"prefilters": []
},
"field_produkt_beschreibung": {
"field": "field_produkt_beschreibung",
"column": true,
"paths": [
"Beschreibung"
],
"default_action": 0,
"default_value": "Text",
"update_mode": 0,
"filters": {
"\u00fc": {
"function": "FeedImportFilter::replace",
"params": [
"[field]",
"ü",
"\u00fc",
"1"
]
},
"\u00e4": {
"function": "FeedImportFilter::replace",
"params": [
"[field]",
"ä",
"\u00e4",
"1"
]
},
"\u00d6": {
"function": "FeedImportFilter::replace",
"params": [
"[field]",
"Ö",
"\u00d6",
"1"
]
},
"\u00f6": {
"function": "FeedImportFilter::replace",
"params": [
"[field]",
"ö",
"\u00f6",
"1"
]
},
"\u00df": {
"function": "FeedImportFilter::replace",
"params": [
"[field]",
"ß",
"\u00df",
"1"
]
},
"R": {
"function": "FeedImportFilter::replace",
"params": [
"[field]",
"®",
" ",
"1"
]
}
},
"prefilters": []
}
},
"static_fields": {
"type": "produkt",
"uid": "3",
"language": "de",
"field_produkt_shop": {
"tid": "20"
},
"title": "Test"
},
"functions": []
}
}
I really would appreciate a hint, about what might be wrong with my setup. Thank you very much,
Simon
It was missing filters and umlaute (ä, ö...) in the text fields. It is working now

How to get all versions of Confluence page via REST API

I would like to retrieve all versions of a page in Confluence. There is a call in the REST API that claims to return the history, but I have little luck with it.
/rest/api/content/{id}/history
When I call this I get a response along these lines:
{"latest": true,
"createdBy": {
"type": "known",
"profilePicture": {
"path": "/confluence/s/en_GB/.../profilepics/Avatar-14.png",
"width": 48,
"height": 48,
"isDefault": false
},
"username": "first.last#abc123.com",
"displayName": "First Last",
"userKey": "userKey"
}, "createdDate": "2014-12-29T13:56:16.000+0100", "_links": {
"base": "https://host.abc123.net/confluence",
"context": "/confluence",
"self": "host.abc123.net/confluence/rest/api/content/12345678/history"
}, "_expandable": {
"lastUpdated": ""
}}
I know that this page has 17 versions in the history through the browser interface. I can't seem to get anywhere by adding any kind of expand= to the query either.
The documentation for Confluence REST API tells me that this call should:
Returns a full JSON representation of the content's history
If I turn to the "normal" REST API call to retrieve content, I can get some hint about the history in the version structure:
{"version": {
"by": {
"type": "known",
"profilePicture": {
"path": "/confluence/s/en_GB/5639/.../profilepics/default.png",
"width": 48,
"height": 48,
"isDefault": true
},
"username": "some.other#abc123",
"displayName": "Some Other",
"userKey": "userKeyGuidThingy"
},
"when": "2015-01-30T16:00:09.000+0100",
"message": "",
"number": 17,
"minorEdit": false
} }
I am very keen on retrieving the other versions, numbers 1 - 16, but I can't see how..
I'd be most grateful for any help to get me unstuck.. :)
Here is an example:
Request:
http://localhost:8090/rest/experimental/content/7965952/version?expand=content
Response:
{
"results": [
{
"by": {
"type": "known",
"username": "admin",
"userKey": "40288ac65c33f555015c33fd0aed0000",
"profilePicture": {
"path": "/download/attachments/327681/user-avatar",
"width": 48,
"height": 48,
"isDefault": false
},
"displayName": "admin",
"_links": {
"self": "http://localhost:8090/rest/experimental/user?key=40288ac65c33f555015c33fd0aed0000"
}
},
"when": "2017-10-16T14:56:29.000+03:00",
"message": "more stuff",
"number": 6,
"minorEdit": false,
"hidden": false,
"content": {
"id": "7965952",
"type": "page",
"status": "current",
"title": "cla1",
"extensions": {
"position": "none"
},
"_links": {
"webui": "/display/S1/cla1",
"tinyui": "/x/AI15",
"self": "http://localhost:8090/rest/api/content/7965952"
},
"_expandable": {
"container": "/rest/api/space/S1",
"metadata": "",
"operations": "",
"children": "/rest/api/content/7965952/child",
"history": "/rest/api/content/7965952/history",
"ancestors": "",
"body": "",
"version": "",
"descendants": "/rest/api/content/7965952/descendant",
"space": "/rest/api/space/S1"
}
},
"_links": {
"self": "http://localhost:8090/rest/experimental/content/7965952/version/6"
}
},
{
"by": {
"type": "known",
"username": "admin",
"userKey": "40288ac65c33f555015c33fd0aed0000",
"profilePicture": {
"path": "/download/attachments/327681/user-avatar",
"width": 48,
"height": 48,
"isDefault": false
},
"displayName": "admin",
"_links": {
"self": "http://localhost:8090/rest/experimental/user?key=40288ac65c33f555015c33fd0aed0000"
}
},
"when": "2017-10-16T14:56:12.000+03:00",
"message": "stuff",
"number": 5,
"minorEdit": false,
"hidden": false,
"content": {
"id": "7965952",
"type": "page",
"status": "historical",
"title": "cla1",
"extensions": {
"position": "none"
},
"_links": {
"webui": "/pages/viewpage.action?pageId=7965962",
"tinyui": "/x/Co15",
"self": "http://localhost:8090/rest/api/content/7965952?status=historical&version=5"
},
"_expandable": {
"container": "",
"metadata": "",
"operations": "",
"children": "/rest/api/content/7965952/child?parentVersion=5",
"history": "/rest/api/content/7965952/history",
"ancestors": "",
"body": "",
"version": "",
"descendants": "/rest/api/content/7965952/descendant",
"space": "/rest/api/space/S1"
}
},
"_links": {
"self": "http://localhost:8090/rest/experimental/content/7965952/version/5"
}
},
{
"by": {
"type": "known",
"username": "admin",
"userKey": "40288ac65c33f555015c33fd0aed0000",
"profilePicture": {
"path": "/download/attachments/327681/user-avatar",
"width": 48,
"height": 48,
"isDefault": false
},
"displayName": "admin",
"_links": {
"self": "http://localhost:8090/rest/experimental/user?key=40288ac65c33f555015c33fd0aed0000"
}
},
"when": "2017-10-16T14:39:28.000+03:00",
"message": "",
"number": 4,
"minorEdit": false,
"hidden": false,
"content": {
"id": "7965952",
"type": "page",
"status": "historical",
"title": "cla1",
"extensions": {
"position": "none"
},
"_links": {
"webui": "/pages/viewpage.action?pageId=7965961",
"tinyui": "/x/CY15",
"self": "http://localhost:8090/rest/api/content/7965952?status=historical&version=4"
},
"_expandable": {
"container": "",
"metadata": "",
"operations": "",
"children": "/rest/api/content/7965952/child?parentVersion=4",
"history": "/rest/api/content/7965952/history",
"ancestors": "",
"body": "",
"version": "",
"descendants": "/rest/api/content/7965952/descendant",
"space": "/rest/api/space/S1"
}
},
"_links": {
"self": "http://localhost:8090/rest/experimental/content/7965952/version/4"
}
},
{
"by": {
"type": "known",
"username": "admin",
"userKey": "40288ac65c33f555015c33fd0aed0000",
"profilePicture": {
"path": "/download/attachments/327681/user-avatar",
"width": 48,
"height": 48,
"isDefault": false
},
"displayName": "admin",
"_links": {
"self": "http://localhost:8090/rest/experimental/user?key=40288ac65c33f555015c33fd0aed0000"
}
},
"when": "2017-10-16T14:39:12.000+03:00",
"message": "",
"number": 3,
"minorEdit": false,
"hidden": false,
"content": {
"id": "7965952",
"type": "page",
"status": "historical",
"title": "cla1",
"extensions": {
"position": "none"
},
"_links": {
"webui": "/pages/viewpage.action?pageId=7965959",
"tinyui": "/x/B415",
"self": "http://localhost:8090/rest/api/content/7965952?status=historical&version=3"
},
"_expandable": {
"container": "",
"metadata": "",
"operations": "",
"children": "/rest/api/content/7965952/child?parentVersion=3",
"history": "/rest/api/content/7965952/history",
"ancestors": "",
"body": "",
"version": "",
"descendants": "/rest/api/content/7965952/descendant",
"space": "/rest/api/space/S1"
}
},
"_links": {
"self": "http://localhost:8090/rest/experimental/content/7965952/version/3"
}
},
{
"by": {
"type": "known",
"username": "admin",
"userKey": "40288ac65c33f555015c33fd0aed0000",
"profilePicture": {
"path": "/download/attachments/327681/user-avatar",
"width": 48,
"height": 48,
"isDefault": false
},
"displayName": "admin",
"_links": {
"self": "http://localhost:8090/rest/experimental/user?key=40288ac65c33f555015c33fd0aed0000"
}
},
"when": "2017-10-16T14:38:36.000+03:00",
"message": "",
"number": 2,
"minorEdit": false,
"hidden": false,
"content": {
"id": "7965952",
"type": "page",
"status": "historical",
"title": "cla1",
"extensions": {
"position": "none"
},
"_links": {
"webui": "/pages/viewpage.action?pageId=7965957",
"tinyui": "/x/BY15",
"self": "http://localhost:8090/rest/api/content/7965952?status=historical&version=2"
},
"_expandable": {
"container": "",
"metadata": "",
"operations": "",
"children": "/rest/api/content/7965952/child?parentVersion=2",
"history": "/rest/api/content/7965952/history",
"ancestors": "",
"body": "",
"version": "",
"descendants": "/rest/api/content/7965952/descendant",
"space": "/rest/api/space/S1"
}
},
"_links": {
"self": "http://localhost:8090/rest/experimental/content/7965952/version/2"
}
},
{
"by": {
"type": "known",
"username": "admin",
"userKey": "40288ac65c33f555015c33fd0aed0000",
"profilePicture": {
"path": "/download/attachments/327681/user-avatar",
"width": 48,
"height": 48,
"isDefault": false
},
"displayName": "admin",
"_links": {
"self": "http://localhost:8090/rest/experimental/user?key=40288ac65c33f555015c33fd0aed0000"
}
},
"when": "2017-10-16T14:23:14.000+03:00",
"message": "",
"number": 1,
"minorEdit": false,
"hidden": false,
"content": {
"id": "7965952",
"type": "page",
"status": "historical",
"title": "cla1",
"extensions": {
"position": "none"
},
"_links": {
"webui": "/pages/viewpage.action?pageId=7965955",
"tinyui": "/x/A415",
"self": "http://localhost:8090/rest/api/content/7965952?status=historical&version=1"
},
"_expandable": {
"container": "",
"metadata": "",
"operations": "",
"children": "/rest/api/content/7965952/child?parentVersion=1",
"history": "/rest/api/content/7965952/history",
"ancestors": "",
"body": "",
"version": "",
"descendants": "/rest/api/content/7965952/descendant",
"space": "/rest/api/space/S1"
}
},
"_links": {
"self": "http://localhost:8090/rest/experimental/content/7965952/version/1"
}
}
],
"start": 0,
"limit": 100,
"size": 6,
"_links": {
"self": "http://localhost:8090/rest/experimental/content/7965952/version?expand=content",
"base": "http://localhost:8090",
"context": ""
}
}
this will get you all versions of a page with version messages
I found the way to get version number.
so If you go to https://confluence.yourdomain.com/rest/api/content/page_id(1234567)/history. You will get the following json response.
{
"previousVersion":{
"by":{
"type":"known",
"profilePicture":{
"path":"image/path",
"width":48,
"height":48,
"isDefault":true
},
"username":"username",
"displayName":"password",
"userKey":"userkey"
},
"when":"date-time",
"message":"",
"number":1,
"minorEdit":false
},
"lastUpdated":{
"by":{
"type":"known",
"profilePicture":{
"path":"image/path",
"width":48,
"height":48,
"isDefault":true
},
"username":"username",
"displayName":"password",
"userKey":"userkey"
},
"when":"date-time",
"message":"",
"number":2,
"minorEdit":false
},
"latest":true,
"createdBy":{
"type":"known",
"profilePicture":{
"path":"image/path",
"width":48,
"height":48,
"isDefault":true
},
"username":"username",
"displayName":"password",
"userKey":"userkey"
},
"createdDate":"userkey",
"_links":{
"base":"https://confluence.yourdomain.com",
"context":"",
"self":"https://confluence.yourdomain.com/rest/api/content/page_id/history"
}
}
From that response json just fetch the version number depends on the scripting language that you are using. For Python following the piece of code will fetch the version number.
version=requests.get(https://confluence.yourdomain.com/rest/api/content/page_id(1234567)/history)
version= version.json()
print version['lastUpdated']['number']
This will give you latest version number of the page.