| Bookmark Name | Actions |
|---|
Examples of REST API Operations using POSTMAN Client
This section shows few examples of REST API operations on DS Package Installer.
Basic Authentication for Requests
Basic authentication parameters are passed such as username and password. You need to specify the same parameter values as defined in the application server level for the TAFJAdmin user having privileges to access the /DSPackageInstaller root URL. These credentials will be used by all requests.
Check Staging Area Status
You need to initiate a GET request to the root /resources/staging resource.
curl --request GET \ --url http://localhost:8080/DSPackageInstaller/resources/staging \ --header 'authorization: Basic dGFmajp0YWZqITIwMTY=' \ --header 'cache-control: no-cache' \ --header 'content-type: application/x-www-form-urlencoded' \ --header 'postman-token: 9596b48f-3a0f-c1f7-3cb1-f8f149511274'
If staging area doesn’t exist, then status nok is returned with missing tables list.
If it exists, then status ok is returned with existing tables making the staging area.
Drop the Staging Area
You need to initiate the DELETE request to /resources/staging.
curl --request DELETE \ --url http://localhost:8080/DSPackageInstaller/resources/staging \ --header 'authorization: Basic dGFmajp0YWZqITIwMTY=' \ --header 'cache-control: no-cache' \ --header 'content-type: application/x-www-form-urlencoded' \ --header 'postman-token: 63e05ff6-b791-dc13-61ed-41dfe2905b7e' \
If staging area exists and is successfully dropped, then status ok is returned.
If staging area doesn’t exist, then status nok is returned.
Create the Staging Area
You need to initiate a POST request to /resources/staging.
curl --request POST \ --url http://localhost:8080/DSPackageInstaller/resources/staging \ --header 'authorization: Basic dGFmajp0YWZqITIwMTY=' \ --header 'cache-control: no-cache' \ --header 'content-type: application/x-www-form-urlencoded' \ --header 'postman-token: 37f51819-9a15-cf5d-99a2-5a598437a889'
Here, response status depends on the existence of the staging area.
For non-existing staging area, status is success (ok).
For an already existing staging area, status is failure (nok).
Check the Package List
To get what are the packages available within the webapp (inferred from package-list file), you need to initiate a GET request to /resources/package.
curl --request GET \ --url http://localhost:8080/DSPackageInstaller/resources/package \ --header 'authorization: Basic dGFmajp0YWZqITIwMTY=' \ --header 'cache-control: no-cache' \ --header 'content-type: application/x-www-form-urlencoded' \ --header 'postman-token: 610bc27e-805a-d968-ebb7-b453ddef12eb'
If a package-list file is found, then status ok is returned with packages present and available for staging.
Check the Package Detail
To check what are the files available for staging (inferred from the package name and its related package-detail file), you need to initiate a GET request to /resources/package/{packageName}. Where, packageName is a valid name returned from the above package list request.
curl --request GET \ --url http://localhost:8080/DSPackageInstaller/resources/package/R17_FT_Modelbank_1_JAVA_17.1 \ --header 'authorization: Basic dGFmajp0YWZqITIwMTY=' \ --header 'cache-control: no-cache' \ --header 'content-type: application/x-www-form-urlencoded' \ --header 'postman-token: 8dae6110-531d-026c-5394-d6d2bd851d0f'
If a package-detail is found for the package name, then status ok is returned with an array of records, represented by their technical key and their path within the webapp.
Check a Record Content
To read a file content within the webapp, you need to initiate a GET request to /resources/package/record/{recordPath}. Where, recordPath is the path to the record as returned from the package detail above.
That is to access
R17_FT_Modelbank_1_JAVA_17.1/ds-generated/AI.ACCTMANDATE.VIEW.enquiry.xml
Escape separators to
R17_FT_Modelbank_1_JAVA_17.1%2Fds-generated%2FAI.ACCTMANDATE.VIEW.enquiry.xml
curl --request GET \ --url http://localhost:8080/DSPackageInstaller/resources/package/record/R17_FT_Modelbank_1_JAVA_17.1%2Fds-generated%2FAI.ACCTMANDATE.VIEW.enquiry.xml \ --header 'authorization: Basic dGFmajp0YWZqITIwMTY=' \ --header 'cache-control: no-cache' \ --header 'content-type: application/x-www-form-urlencoded' \ --header 'postman-token: d59c7bee-cdc3-dd78-e031-ee1663e3e054' If the record path exists the record content is returned with status ‘ok’.
Write all Packages to the Staging Area
To write all files of each package from the package-list (to TAFJ_PACKAGE and TAFJ_PACKAGE_RECORD with default component implementation), initiate a PUT request to /resources/staging/all.
curl --request PUT \ --url http://localhost:8080/DSPackageInstaller/resources/staging/all \ --header 'authorization: Basic dGFmajp0YWZqITIwMTY=' \ --header 'cache-control: no-cache' \ --header 'content-type: application/x-www-form-urlencoded' \ --header 'postman-token: e9905ea1-ddb4-be05-9091-8a335305ae4e'
If the staging area has been created and all files are successfully written to the staging area tables, then the list of files persisted with their technical key and path are returned with status ok. Otherwise, status will be nok with the list of files which have failed to be written.
Write a Package to the Staging Area
To write all files of a package to the staging area (to TAFJ_PACKAGE and TAFJ_PACKAGE_RECORD with default component implementation); initiate a PUT request to /resources/staging.
The package to be persisted has to be passed through a form url encoded parameter as shown below with parameter name packageName.
curl --request PUT \ --url http://localhost:8080/DSPackageInstaller/resources/staging \ --header 'authorization: Basic dGFmajp0YWZqITIwMTY=' \ --header 'cache-control: no-cache' \ --header 'content-type: application/x-www-form-urlencoded' \ --header 'postman-token: 6a092c9d-334a-2a27-0a8e-3629b68ee796' \ --data packageName=R17_FT_Modelbank_1_JAVA_17.1
If the staging area has been created and all files are successfully written to the staging area tables, then the list of files persisted with their technical key and path are returned with status ok. Otherwise, status will be nok with the list of files which have failed to be written.
Write a Single Record
Place a PUT request to /resources/staging/record/. The record to be persisted has to be passed through form url encoded parameters as shown below with parameter name recordKey and recordPath.
Record path separators needs to be escaped (/) and replaced by %2F.
curl --request PUT \ --url http://localhost:8080/DSPackageInstaller/resources/staging/record \ --header 'authorization: Basic dGFmajp0YWZqITIwMTY=' \ --header 'cache-control: no-cache' \ --header 'content-type: application/x-www-form-urlencoded' \ --header 'postman-token: 78707c51-ccaf-4cd1-55e3-5c6be2104d89' \ --data 'recordKey=R17_FT_Modelbank_1_JAVA_17.1-2&recordPath=R17_FT_Modelbank_1_JAVA_17.1%2Fds-generated%2F151.xml'
Read a Record from the Staging Area
To check if a record has effectively been persisted, its content can be read from the staging area by placing a GET request to /resources/staging/record/{recordKey}. Where, recordKey is the technical record key, RECID at staging area level.
curl --request GET \ --url http://localhost:8080/DSPackageInstaller/resources/staging/record/R17_FT_Modelbank_1_JAVA_17.1-2 \ --header 'authorization: Basic dGFmajp0YWZqITIwMTY=' \ --header 'cache-control: no-cache' \ --header 'content-type: application/x-www-form-urlencoded' \ --header 'postman-token: 74c5cee1-6b50-4c6b-d7a8-0fa400d01f24'
If the record is found, then status ok is returned with record content.
Read a Package from the Staging Area
To check whether all records part of the package (package-detail entries) are written to the staging area; place a GET request to /resources/staging/{packageName}. Where, packageName is the package name as shown in the package-list.
curl --request GET \ --url http://localhost:8080/DSPackageInstaller/resources/staging/R17_FT_Modelbank_1_JAVA_17.1 \ --header 'authorization: Basic dGFmajp0YWZqITIwMTY=' \ --header 'cache-control: no-cache' \ --header 'content-type: application/x-www-form-urlencoded' \ --header 'postman-token: 05358b10-d116-aafa-39ff-259551f27aad'
It returns the status ok and the list of records successfully written to the staging area.
If there are missing records, then it means entries are present in the package-detail but not at staging area level, therefore, their list will be returned with status nok.
Clear the Staging Area
To clear all tables part of the staging area issue a POST request to /resources/staging/clear.
curl --request POST \ --url http://localhost:8080/DSPackageInstaller/resources/staging/clear \ --header 'authorization: Basic dGFmajp0YWZqITIwMTY=' \ --header 'cache-control: no-cache' \ --header 'content-type: application/x-www-form-urlencoded' \ --header 'postman-token: 26d33642-6748-efa2-3b88-d297a76e1d02'
Status ok with list of tables cleared is returned.
Delete all Packages from the Staging Area
To delete entries related to all packages part of the package-list from the staging area; place a DELETE request to /resources/staging/all.
curl --request DELETE \ --url http://localhost:8080/DSPackageInstaller/resources/staging/all \ --header 'authorization: Basic dGFmajp0YWZqITIwMTY=' \ --header 'cache-control: no-cache' \ --header 'content-type: application/x-www-form-urlencoded' \ --header 'postman-token: 3e71d9e9-d637-7721-2bab-5150485cd26b' \
Delete a Package from the Staging Area
To delete all entries related to a specific package from the staging area; place a DELETE request to /resources/staging/{packageName}.
curl --request DELETE \ --url http://localhost:8080/DSPackageInstaller/resources/staging/R17_FT_Modelbank_1_JAVA_17.1 \ --header 'authorization: Basic dGFmajp0YWZqITIwMTY=' \ --header 'cache-control: no-cache' \ --header 'content-type: application/x-www-form-urlencoded' \ --header 'postman-token: 503d55f1-deff-75de-a64c-898d00e32593' \
Delete a Single Record from the Staging Area
DELETE request to /resources/staging/record/{recordKey}.
curl --request DELETE \ --url http://localhost:8080/DSPackageInstaller/resources/staging/record/R17_FT_Modelbank_1_JAVA_17.1-1 \ --header 'authorization: Basic dGFmajp0YWZqITIwMTY=' \ --header 'cache-control: no-cache' \ --header 'content-type: application/x-www-form-urlencoded' \ --header 'postman-token: 8ecbee0d-c249-fb57-08c3-25ed2d3a582f' \
Add Bookmark
save your best linksView Bookmarks
Visit your best linksIn this topic
Are you sure you want to log-off?
/REST API to Interact with_34.png)