How can I get a specific attribute from the JSON response where I have multiple levels of nested objects in the schema

0
When I hit a specific Polarion  URL, I got the following response, which is a simple JSON response.   (Note: I want to retrieve the self URL)     However, where as coming to the schema, it is two complex with multiple levels of nested objects. How do I know which entity contains or stores my required attribute. Hope you got my problem.   The Original Schema:   { "data": { "type": { "type": "string", "enum": [ "workitems" ] }, "id": { "type": "string", "example": "MyProjectId/MyWorkItemId" }, "revision": { "type": "string", "example": "1234" }, "attributes": { "created": { "type": "string", "format": "date-time", "example": "1970-01-01T00:00:00Z" }, "description": { "type": { "type": "string", "enum": [ "text/html", "text/plain" ] }, "value": { "type": "string", "example": "My text value" } }, "dueDate": { "type": "string", "format": "date", "example": "1970-01-01" }, "hyperlinks": { "type": "array", "items": { "role": { "type": "string", "example": "ref_ext" }, "uri": { "type": "string", "example": "https://polarion.plm.automation.siemens.com" } } }, "id": { "type": "string", "example": "MyWorkItemId" }, "initialEstimate": { "type": "string", "example": "5 1/2d" }, "outlineNumber": { "type": "string", "example": "1.11" }, "plannedEnd": { "type": "string", "format": "date-time", "example": "1970-01-01T00:00:00Z" }, "plannedStart": { "type": "string", "format": "date-time", "example": "1970-01-01T00:00:00Z" }, "priority": { "type": "string", "example": "90.0" }, "remainingEstimate": { "type": "string", "example": "5 1/2d" }, "resolution": { "type": "string", "example": "done" }, "resolvedOn": { "type": "string", "format": "date-time", "example": "1970-01-01T00:00:00Z" }, "severity": { "type": "string", "example": "blocker" }, "status": { "type": "string", "example": "open" }, "timeSpent": { "type": "string", "example": "5 1/2d" }, "title": { "type": "string", "example": "Title" }, "type": { "type": "string", "example": "task" }, "updated": { "type": "string", "format": "date-time", "example": "1970-01-01T00:00:00Z" } }, "relationships": { "approvals": { "data": { "type": "array", "items": { "id": { "type": "string", "example": "MyProjectId/MyWorkItemId/MyWorkRecordId" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "workrecords" ] } } }, "meta": { "totalCount": { "type": "integer", "format": "int32" } } }, "assignee": { "data": { "type": "array", "items": { "id": { "type": "string", "example": "MyUserId" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "users" ] } } }, "meta": { "totalCount": { "type": "integer", "format": "int32" } } }, "attachments": { "data": { "type": "array", "items": { "id": { "type": "string", "example": "MyProjectId/MyWorkItemId/MyAttachmentId" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "workitem_attachments" ] } } }, "links": { "related": { "type": "string", "example": "server-host-name/application-path/projects/MyProjectId/workitems/MyWorkItemId/attachments?revision=1234" } }, "meta": { "totalCount": { "type": "integer", "format": "int32" } } }, "author": { "data": { "id": { "type": "string", "example": "MyUserId" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "users" ] } } }, "backlinkedWorkItems": { "data": { "type": "array", "items": { "id": { "type": "string", "example": "MyProjectId/MyWorkItemId/parent/MyProjectId/MyLinkedWorkItemId" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "linkedworkitems" ] } } }, "meta": { "totalCount": { "type": "integer", "format": "int32" } } }, "categories": { "data": { "type": "array", "items": { "id": { "type": "string", "example": "MyProjectId/MyCategoryId" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "categories" ] } } }, "meta": { "totalCount": { "type": "integer", "format": "int32" } } }, "comments": { "data": { "type": "array", "items": { "id": { "type": "string", "example": "MyProjectId/MyWorkItemId/MyCommentId" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "workitem_comments" ] } } }, "links": { "related": { "type": "string", "example": "server-host-name/application-path/projects/MyProjectId/workitems/MyWorkItemId/comments?revision=1234" } }, "meta": { "totalCount": { "type": "integer", "format": "int32" } } }, "externallyLinkedWorkItems": { "data": { "type": "array", "items": { "id": { "type": "string", "example": "MyProjectId/MyWorkItemId/parent/hostname/MyProjectId/MyLinkedWorkItemId" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "externallylinkedworkitems" ] } } }, "meta": { "totalCount": { "type": "integer", "format": "int32" } } }, "linkedOslcResources": { "data": { "type": "array", "items": { "id": { "type": "string", "example": "MyProjectId/MyWorkItemId/http://server-host-name/ns/cm#relatedChangeRequest/http://server-host-name/application-path/oslc/services/projects/MyProjectId/workitems/MyWorkItemId" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "linkedoslcresources" ] } } }, "meta": { "totalCount": { "type": "integer", "format": "int32" } } }, "linkedRevisions": { "data": { "type": "array", "items": { "id": { "type": "string", "example": "default/1234" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "revisions" ] } } }, "meta": { "totalCount": { "type": "integer", "format": "int32" } } }, "linkedWorkItems": { "data": { "type": "array", "items": { "id": { "type": "string", "example": "MyProjectId/MyWorkItemId/parent/MyProjectId/MyLinkedWorkItemId" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "linkedworkitems" ] } } }, "links": { "related": { "type": "string", "example": "server-host-name/application-path/projects/MyProjectId/workitems/MyWorkItemId/linkedworkitems?revision=1234" } }, "meta": { "totalCount": { "type": "integer", "format": "int32" } } }, "module": { "data": { "id": { "type": "string", "example": "MyProjectId/MySpaceId/MyDocumentId" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "documents" ] } } }, "plannedIn": { "data": { "type": "array", "items": { "id": { "type": "string", "example": "MyProjectId/MyPlanId" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "plans" ] } } }, "meta": { "totalCount": { "type": "integer", "format": "int32" } } }, "project": { "data": { "id": { "type": "string", "example": "MyProjectId" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "projects" ] } } }, "testSteps": { "data": { "type": "array", "items": { "id": { "type": "string", "example": "MyProjectId/MyWorkItemId/MyTestStepIndex" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "teststeps" ] } } }, "meta": { "totalCount": { "type": "integer", "format": "int32" } } }, "votes": { "data": { "type": "array", "items": { "id": { "type": "string", "example": "MyUserId" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "users" ] } } }, "meta": { "totalCount": { "type": "integer", "format": "int32" } } }, "watches": { "data": { "type": "array", "items": { "id": { "type": "string", "example": "MyUserId" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "users" ] } } }, "meta": { "totalCount": { "type": "integer", "format": "int32" } } }, "workRecords": { "data": { "type": "array", "items": { "id": { "type": "string", "example": "MyProjectId/MyWorkItemId/MyWorkRecordId" }, "revision": { "type": "string", "example": "1234" }, "type": { "type": "string", "enum": [ "workrecords" ] } } }, "meta": { "totalCount": { "type": "integer", "format": "int32" } } } }, "links": { "portal": { "type": "string", "example": "server-host-name/application-path/polarion/redirect/project/MyProjectId/workitem?id=MyWorkItemId&revision=1234" }, "self": { "type": "string", "example": "server-host-name/application-path/projects/MyProjectId/workitems/MyWorkItemId?revision=1234" } }, "meta": { "errors": { "type": "array", "items": { "detail": { "type": "string", "description": "Human-readable explanation specific to this occurrence of the problem.", "example": "Unexpected token, BEGIN_ARRAY expected, but was : BEGIN_OBJECT (at $.data)" }, "source": { "parameter": { "type": "string", "description": "String indicating which URI query parameter caused the error.", "example": "revision" }, "pointer": { "type": "string", "description": "JSON Pointer to the associated entity in the request document.", "example": "$.data" }, "resource": { "id": { "type": "string", "example": "MyProjectId/id" }, "type": { "type": "string", "example": "type" } } }, "status": { "type": "string", "description": "HTTP status code applicable to this problem.", "example": "400" }, "title": { "type": "string", "description": "Short, human-readable summary of the problem.", "example": "Bad Request" } } } } }, "included": { "type": "array", "description": "Related entities might be returned, see REST API User Guide.", "items": { "type": "object" } }, "links": { "self": { "type": "string", "example": "server-host-name/application-path/projects/MyProjectId/workitems/MyWorkItemId?revision=1234" } } }    
asked
1 answers
1

Hi B,

 

In summary, what you can do is:

 

* Copy this JSON data and put it in a JSON Structure document.

* Create an Import Mapping document based on this JSON Structure document.

* In the import mapping, only check the checkbox for the fields you are interested in, and generate the entities for this.

* In your microflow where you are receiving your JSON, add a Call REST action, and in the response tab you configure 'Apply import mapping' where you use the just created import mapping.

 

I hope this helps. Let me know if you need more information.

 

Paul

 

answered