In this example, you will see how to go through the life cycle of an EPC object. We will create, retrieve, update and delete a document set.

1. Create a document set

To create an object in EPC using the API, you always have to specify its parent using its node ID. The parent of a set is the environment in which you want to create the set.
You also have to always specify the type of node you want to create. In that case, we will use the node type DOCUMENT_SET as we want to create a document set.
The last mandatory information is its name.

POST http://myepc.interfacing.com/api/v1/items

15:35:11.219 request:
1 > POST http://myepc.interfacing.com/api/v1/items?draft=true
1 > Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
1 > Content-Type: application/json; charset=UTF-8
1 > Content-Length: 139
1 > Host: myepc.interfacing.com
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.15)
1 > Accept-Encoding: gzip,deflate
{
  "parent": {
    "nodeId": "A9CCB5F4-9A79-8AE7-8C4C-289A025D0D88"
  },
  "@type": "NodeElement",
  "name": "my first document set",
  "nodeType": "DOCUMENT_SET"
}
15:35:11.276 response time in milliseconds: 57
1 < 200
1 < Server: nginx/1.21.6
1 < Date: Wed, 08 Jun 2022 19:35:11 GMT
1 < Content-Type: application/json
1 < Content-Length: 526
1 < X-Varnish: 198276
1 < Age: 0
1 < Via: 1.1 varnish (Varnish/7.1)
1 < Connection: keep-alive
{
  "nodeSubTypeName": null,
  "userNodeSubType": null,
  "@type": "BaseElement",
  "nodeVersionId": "413426F8-66D4-49F6-843C-2F7AFEB298F5",
  "nodeType": "DOCUMENT_SET",
  "creationDate": "2022-06-08T15:35:11.253-04:00",
  "nodeStatus": "IN_PROGRESS",
  "publishedNodeVersionId": null,
  "version": "0.0001",
  "nodeSubType": null,
  "modificationDate": "2022-06-08T15:35:11.253-04:00",
  "extensions": null,
  "deleted": false,
  "system": false,
  "referenceNumber": null,
  "name": "my first document set",
  "locked": false,
  "nodeId": "1450CEF9-89A3-4B48-98F7-09735BECD54B",
  "favorite": false
}

In response, you’ll receive the base information of the created object. It will contain its node ID and node version ID that can be reused later to retrieve update or delete.

CURL Example

curl --request POST --url 'http://myepc.interfacing.com/api/v1/items?draft=true' --header 'Content-Type: application/json' -b /tmp/cookie.tmp \
--data '{
"parent": {
"nodeId": "A9CCB5F4-9A79-8AE7-8C4C-289A025D0D88"
},
"@type": "NodeElement",
"name": "my first document set",
"nodeType": "DOCUMENT_SET"
}'

2. Retrieve a document set

To retrieve an EPC object, you only have to specify its node ID.

GET http://myepc.interfacing.com/api/v1/items/[node-Id]

15:35:11.279 request:
2 > GET http://myepc.interfacing.com/api/v1/items/1450CEF9-89A3-4B48-98F7-09735BECD54B?draft=true
2 > Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
2 > Host: myepc.interfacing.com
2 > Connection: Keep-Alive
2 > User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.15)
2 > Accept-Encoding: gzip,deflate
15:35:11.351 response time in milliseconds: 71
2 < 200
2 < Server: nginx/1.21.6
2 < Date: Wed, 08 Jun 2022 19:35:11 GMT
2 < Content-Type: application/json
2 < Content-Length: 526
2 < ETag: W/"06DE9CB7-1E56-49D1-A373-00DFAA8C1C1A|2022-06-08 19:35:11.26"
2 < Cache-Control: no-cache, no-transform, private
2 < X-Varnish: 819211
2 < Age: 0
2 < Via: 1.1 varnish (Varnish/7.1)
2 < Connection: keep-alive
{
  "nodeSubTypeName": null,
  "userNodeSubType": null,
  "@type": "BaseElement",
  "nodeVersionId": "413426F8-66D4-49F6-843C-2F7AFEB298F5",
  "nodeType": "DOCUMENT_SET",
  "creationDate": "2022-06-08T15:35:11.253-04:00",
  "nodeStatus": "IN_PROGRESS",
  "publishedNodeVersionId": null,
  "version": "0.0001",
  "nodeSubType": null,
  "modificationDate": "2022-06-08T15:35:11.253-04:00",
  "extensions": null,
  "deleted": false,
  "system": false,
  "referenceNumber": null,
  "name": "my first document set",
  "locked": false,
  "nodeId": "1450CEF9-89A3-4B48-98F7-09735BECD54B",
  "favorite": false
}

In response, you’ll receive the base information, the same as when you created the object.

CURL Example

curl --request GET --url 'http://myepc.interfacing.com/api/v1/items/1450CEF9-89A3-4B48-98F7-09735BECD54B?draft=true' -b /tmp/cookie.tmp

3. Update a document set

To update an EPC object using the API, you must send the complete structure of the new version of the object along with its current node version ID.

PUT http://myepc.interfacing.com/api/v1/items/[node-Id]

15:35:11.354 request:
3 > PUT http://myepc.interfacing.com/api/v1/items/1450CEF9-89A3-4B48-98F7-09735BECD54B?draft=true
3 > Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
3 > Content-Type: application/json; charset=UTF-8
3 > Content-Length: 229
3 > Host: myepc.interfacing.com
3 > Connection: Keep-Alive
3 > User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.15)
3 > Accept-Encoding: gzip,deflate
{
  "parent": {
    "nodeId": "A9CCB5F4-9A79-8AE7-8C4C-289A025D0D88"
  },
  "@type": "NodeElement",
  "nodeVersionId": "413426F8-66D4-49F6-843C-2F7AFEB298F5",
  "name": "new name",
  "nodeType": "DOCUMENT_SET",
  "nodeId": "1450CEF9-89A3-4B48-98F7-09735BECD54B"
}
15:35:11.440 response time in milliseconds: 86
3 < 200
3 < Server: nginx/1.21.6
3 < Date: Wed, 08 Jun 2022 19:35:11 GMT
3 < Content-Type: application/json
3 < Content-Length: 513
3 < X-Varnish: 198279
3 < Age: 0
3 < Via: 1.1 varnish (Varnish/7.1)
3 < Connection: keep-alive
{
  "nodeSubTypeName": null,
  "userNodeSubType": null,
  "@type": "BaseElement",
  "nodeVersionId": "BFA4C9F0-89C6-46C1-BD93-7CE15988BF5C",
  "nodeType": "DOCUMENT_SET",
  "creationDate": "2022-06-08T15:35:11.253-04:00",
  "nodeStatus": "IN_PROGRESS",
  "publishedNodeVersionId": null,
  "version": "0.0002",
  "nodeSubType": null,
  "modificationDate": "2022-06-08T15:35:11.367-04:00",
  "extensions": null,
  "deleted": false,
  "system": false,
  "referenceNumber": null,
  "name": "new name",
  "locked": false,
  "nodeId": "1450CEF9-89A3-4B48-98F7-09735BECD54B",
  "favorite": false
}

In response, you’ll receive the base information of the object including its new node version ID and version number.

CURL Example

curl --request PUT --url 'http://myepc.interfacing.com/api/v1/items/1450CEF9-89A3-4B48-98F7-09735BECD54B?draft=true' --header 'Content-Type: application/json' -b /tmp/cookie.tmp \
--data '{
"parent": {
"nodeId": "A9CCB5F4-9A79-8AE7-8C4C-289A025D0D88"
},
"@type": "NodeElement",
"nodeVersionId": "413426F8-66D4-49F6-843C-2F7AFEB298F5",
"name": "new name",
"nodeType": "DOCUMENT_SET",
"nodeId": "1450CEF9-89A3-4B48-98F7-09735BECD54B"
}'

4. Delete a document set

To delete an EPC object using the API, we only have to specify its node ID in the URL and use an empty body.

DELETE http://myepc.interfacing.com/api/v1/items/[node-Id]

15:35:11.441 request:
4 > DELETE http://myepc.interfacing.com/api/v1/items/1450CEF9-89A3-4B48-98F7-09735BECD54B?draft=true
4 > Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
4 > Content-Type: application/json; charset=UTF-8
4 > Content-Length: 2
4 > Host: myepc.interfacing.com
4 > Connection: Keep-Alive
4 > User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.15)
4 > Accept-Encoding: gzip,deflate
{
}
15:35:11.617 response time in milliseconds: 176
4 < 200
4 < Server: nginx/1.21.6
4 < Date: Wed, 08 Jun 2022 19:35:11 GMT
4 < Content-Type: application/json
4 < Content-Length: 514
4 < X-Varnish: 819214
4 < Age: 0
4 < Via: 1.1 varnish (Varnish/7.1)
4 < Connection: keep-alive
[
  {
    "nodeSubTypeName": null,
    "userNodeSubType": null,
    "@type": "BaseElement",
    "nodeVersionId": "BFA4C9F0-89C6-46C1-BD93-7CE15988BF5C",
    "nodeType": "DOCUMENT_SET",
    "creationDate": "2022-06-08T15:35:11.253-04:00",
    "nodeStatus": "IN_PROGRESS",
    "publishedNodeVersionId": null,
    "version": "0.0002",
    "nodeSubType": null,
    "modificationDate": "2022-06-08T15:35:11.500-04:00",
    "extensions": null,
    "deleted": true,
    "system": false,
    "referenceNumber": null,
    "name": "new name",
    "locked": false,
    "nodeId": "1450CEF9-89A3-4B48-98F7-09735BECD54B",
    "favorite": false
  }
]

In response, you’ll have basic information fo the object that has been deleted

CURL Example

curl --request DELETE --url 'http://myepc.interfacing.com/api/v1/items/1450CEF9-89A3-4B48-98F7-09735BECD54B?draft=true' --header 'Content-Type: application/json' -b /tmp/cookie.tmp \
--data '{}'

Reaktion

War das hilfreich?

Ja Nein
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Hinterlasse einen Kommentar.

Bitte stellen Sie hier keine Supportanfragen.
Visit the Support Portal

Kommentar senden