To support XML content type for CPS API's s
References
Jira |
---|
server | ONAP Jira |
---|
columnIds | issuekey,summary,issuetype,created,updated,duedate,assignee,reporter,priority,status,resolution |
---|
columns | key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution |
---|
serverId | 425b2b0a-557c-3c0c-b515-579789cceedb |
---|
key | CPS-2071 |
---|
|
Code Block |
---|
language | xml |
---|
theme | Confluence |
---|
title | Let's say Sample XML Data |
---|
collapse | true |
---|
|
<?xml version='1.0' encoding='UTF-8'?>
<bookstore xmlns="org:onap:ccsdk:sample">
<bookstore-name>Chapters</bookstore-name>
<categories>
<code>1</code>
<name>SciFi</name>
<books>
<title>A Space Odyssey</title>
<lang>en</lang>
<authors>
Iain M. Banks
</authors>
<pub_year>1994</pub_year>
<price>895</price>
</books>
</categories>
</bookstore>
|
Issues & Decisions
S.no | API | Xpath | Expected Output |
---|
1. |
Get | Get a node : GET /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/node | / |
Code Block |
---|
language | xml |
---|
theme | Confluence |
---|
title | Output Response |
---|
collapse | true |
---|
| <?xml version='1.0' encoding='UTF-8'?>
<bookstore xmlns="org:onap:ccsdk:sample">
<bookstore-name>Chapters</bookstore-name>
<categories>
<code>1</code>
<name>SciFi</name>
<books>
<title> A Space Odyssey</title>
<lang>en</lang>
<authors>
Iain M. Banks
</authors>
<pub_year>1994</pub_year>
<price>895</price>
</books>
</categories>
</bookstore> |
|
2. |
Update | Update node leaves : PATCH /{apiVersion}/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes |
/bookstore/categories[@code=1]Endpoint will remains same , ContentType header is added. This API accepts XML data and performs update operation | /bookstore |
Code Block |
---|
language | xml |
---|
theme | Confluence |
---|
title | Output Response |
---|
collapse | true |
---|
| <?xml version='1.0' encoding='UTF-8'?>
<bookstore xmlns="org:onap:ccsdk:sample">
<code>1</code>
<name>some-name</name>
</bookstore> |
|
3. | Replace a node with descendants: PUT /{apiVersion}/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes | /bookstore/categories[@code=1] | Here node will be replaced by child nodes |
4. |
Add | Add list element(s): POST /{apiVersion}/dataspaces/{dataspace-name}/anchors/{anchor-name}/list-nodes | /bookstore/categories[@code=1] |
Code Block |
---|
language | xml |
---|
theme | Confluence |
---|
title | Output Response |
---|
collapse | true |
---|
| <?xml version='1.0' encoding='UTF-8'?>
<bookstore xmlns="org:onap:ccsdk:sample">
<bookstore-name>Chapters</bookstore-name>
<categories>
<code>1</code>
<name>SciFi</name>
<books>
<title>A Space Odyssey</title>
<lang>en</lang>
<authors>
Iain M. Banks
</authors>
<pub_year>1994</pub_year>
<price>895</price>
<title>unknown</title>
<lang>english</lang>
<authors>
Maxwell
</authors>
<pub_year>1998</pub_year>
<price>1000</price>
</books>
</categories>
|
|
5. |
Replace | Replace list content: PUT /{apiVersion}/dataspaces/{dataspace-name}/anchors/{anchor-name}/list-nodes | /bookstore/categories[@code=1] |
Code Block |
---|
language | xml |
---|
theme | Confluence |
---|
title | Output Response |
---|
collapse | true |
---|
| <?xml version='1.0' encoding='UTF-8'?>
<bookstore xmlns="org:onap:ccsdk:sample">
<bookstore-name>Chapters</bookstore-name>
<categories>
<code>1</code>
<name>SciFi</name>
<books>
<title> A Space Odyssey</title>
<lang>Economics</lang>
<authors>
John smith
</authors>
<pub_year>1997</pub_year>
<price>995</price>
</books>
</categories>
</bookstore>
|
|
6. | Query data nodes: GET /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query | //books[@title=" A Space Odyssey"] |
Code Block |
---|
language | xml |
---|
theme | Confluence |
---|
title | Output Response |
---|
collapse | true |
---|
| <?xml version='1.0' encoding='UTF-8'?>
<bookstore xmlns="org:onap:ccsdk:sample">
<books>
<title> A Space Odyssey</title>
<lang>en</lang>
<authors>
Iain M. Banks
</authors>
<pub_year>1994</pub_year>
<price>895</price>
</books>
</bookstore>
|
|
7. |
Query | Query data nodes across anchors: GET /v2/dataspaces/{dataspace-name}/nodes/query | //books[@title=" A Space Odyssey"] |
Code Block |
---|
language | xml |
---|
theme | Confluence |
---|
title | Output Response |
---|
collapse | true |
---|
| <?xml version='1.0' encoding='UTF-8'?>
<bookstore xmlns="org:onap:ccsdk:sample">
<books>
<title> A Space Odyssey</title>
<lang>en</lang>
<authors>
Iain M. Banks
</authors>
<pub_year>1994</pub_year>
<price>895</price>
</books>
</bookstore> |
|