Forum Discussion
Former_Member
8 years agoAccelerator III
Hi Christopher,
I found the property "related_id". I also found the error why I suspected that this variable is just not set to a value.
For testing I often use the query capabilities of the Rest API. In this case I have not yet found a way to query the "related_id". Under certain circumstances this is related to the null RelationshipType. Or do I make a mistake with the query?!
For the documentation. The following method (C#) works and returns the correct relation
For the documentation. The following method (C#) works and returns the correct relation
Innovator inn = this.getInnovator(); Item process = inn.getItemById("Activity Template", "B9F2FE5B576546B18846A39AD854C2CF"); process.fetchRelationships("Workflow Map Path"); Item qryItem = inn.newItem("Workflow Map Path","get"); qryItem.setProperty("source_id", process.getProperty("id")); qryItem.setPropertyCondition("source_id", "eq"); Item results = qryItem.apply(); Item item = results.getItemByIndex(0); string output = "\r\n" + "Workflow Map Path ID: " + item.getProperty("id") + "\r\n"; output += "source_id: " + item.getProperty("source_id") + "\r\n"; output += "related_id: " + item.getProperty("related_id") + "\r\n"; return inn.newResult(output);
<Result> Workflow Map Path ID: 654FF9665F2F415683722C6AA698A1DE source_id: B9F2FE5B576546B18846A39AD854C2CF related_id: 414750EF9F62450A87621429F7B7B339 </Result>When querying via Rest-API, I unfortunately don't get the desired success. Directly I can only query the "source_id"-Property. The Rest-Call
plmserver/.../Workflow Map Path('654FF9665F2F415683722C6AA698A1DE')Results in the return of structured data in JSON format. However, the properties are not listed here.
{ "@odata.context": "plmserver/.../$metadata Map Path/$entity", "authentication": "none", "behavior": "float", "created_on": "2018-10-09T23:04:11", "generation": "1", "id": "654FF9665F2F415683722C6AA698A1DE", "is_current": "1", "is_default": "0", "is_override": "0", "is_released": "0", "keyed_name": "654FF9665F2F415683722C6AA698A1DE", "major_rev": "A", "modified_on": "2018-10-09T23:04:11", "name": "TestPath", "new_version": "1", "not_lockable": "0", "segments": "", "sort_order": "128", "x": "0", "y": "0" }The source id can be accessed by extending the query.
plmserver/.../id
{ "@odata.context": "plmserver/.../$metadata Map Path('654FF9665F2F415683722C6AA698A1DE')/source_id/id", "value": "B9F2FE5B576546B18846A39AD854C2CF" }This procedure does not work with the related id.
plmserver/.../id
{ { "error": { "code": "BadRequest", "message": "Value cannot be null.\r\nParameter name: criteria" } }The only possibility I have found is this query, but then the data is no longer structured.
plmserver/.../$valueThis is not critical for my use case. But maybe this is interesting for future applications. Thanks again Christopher for your quick help. Greetings Rik