Last active
July 6, 2022 18:49
-
-
Save TiloGit/4ff1564e53668c0a52d8d4185fb1e70e to your computer and use it in GitHub Desktop.
ICN (navigator) curl example with CP4BA IAM and ZEN (CPD)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iamURL="cp-console.apps.ocp6.tsodev.com" | |
cpdURL="cpd-alf1.apps.ocp6.tsodev.com" | |
userid="cp4baadmin" | |
userpw="mypass123" | |
##now in chain | |
iamToken=$(curl -b icncookie.txt -c icncookie.txt -k -s -X POST -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" -d "grant_type=password&username=$userid&password=$userpw&scope=openid" https://$iamURL/idprovider/v1/auth/identitytoken | jq '.access_token' | xargs) | |
echo $iamToken | |
##get cpd Token/Zen token | |
cpdToken=$(curl -b icncookie.txt -c icncookie.txt -k -s -X GET "https://$cpdURL/v1/preauth/validateAuth" -H "username: $userid" -H "iam-token: $iamToken" | jq '.accessToken' | xargs) | |
echo $cpdToken | |
##ICN Test Navigator Logon | |
#ICN return bad JSON, cut first chars | |
#curl -k -s -H "Authorization: Bearer $cpdToken" \ | |
-H 'Content-Type: application/x-www-form-urlencoded' \ | |
-X POST https://$cpdURL/icn/navigator/jaxrs/logon | awk '{ print substr( $0, 5 ) }' | jq . | |
icnSecToken=$(curl -b icncookie.txt -c icncookie.txt -s -k -H "Authorization: Bearer $cpdToken" -H 'Content-Type: application/x-www-form-urlencoded' -X POST https://$cpdURL/icn/navigator/jaxrs/logon | awk '{ print substr( $0, 5 ) }' | jq '.security_token' | xargs) | |
echo $icnSecToken | |
############### | |
#Test P8 Logon << Working | |
curl -b icncookie.txt -c icncookie.txt -s -k -H "Authorization: Bearer $cpdToken" \ | |
-H 'Content-Type: application/x-www-form-urlencoded' -H "security_token: $icnSecToken" \ | |
--data-urlencode "repositoryId=icmos01" \ | |
--data-urlencode "objectStore=OS01" \ | |
--data-urlencode "serverName=https://vf2-cpe-stateless-svc:9443/wsi/FNCEWS40MTOM/" \ | |
--data-urlencode "protocol=FileNetP8WSI" \ | |
--data-urlencode "password=$userpw" \ | |
-X POST https://$cpdURL/icn/navigator/jaxrs/p8/logon --data-urlencode "userid=$userid" | awk '{ print substr( $0, 5 ) }' | jq . | |
##get plugin list (Working !!!) | |
curl -b icncookie.txt -c icncookie.txt -k -s -H "Authorization: Bearer $cpdToken" \ | |
-H 'Content-Type: application/x-www-form-urlencoded' -H "security_token: $icnSecToken" \ | |
-X POST https://$cpdURL/icn/navigator/jaxrs/admin/configuration --data-raw "action=list&id=navigator&userid=$userid&type=plugins&sorted=true&configuration=ApplicationConfig&login_desktop=admin&application=navigator&securityTopic=plugins.plugins&desktop=admin" | awk '{ print substr( $0, 5 ) }' | jq '.list[] | .name , .version' | |
##get repositories list of ICN (Working !!!) | |
curl -b icncookie.txt -c icncookie.txt -k -s -H "Authorization: Bearer $cpdToken" \ | |
-H 'Content-Type: application/x-www-form-urlencoded' -H "security_token: $icnSecToken" \ | |
-X POST https://$cpdURL/icn/navigator/jaxrs/admin/configuration --data-raw "action=list&id=navigator&userid=$userid&type=repositories&sorted=true&configuration=ApplicationConfig&login_desktop=admin&application=navigator&securityTopic=repos.repos&desktop=admin" | awk '{ print substr( $0, 5 ) }' | jq '.list[] | .name , .id' | |
############### | |
##case style test call | |
## use F12 broser debug and select Copy as cURL to get the raw data part | |
############### | |
#P8 Logon << Working | |
curl -b icncookie.txt -c icncookie.txt -s -k -H "Authorization: Bearer $cpdToken" \ | |
-H 'Content-Type: application/x-www-form-urlencoded' -H "security_token: $icnSecToken" \ | |
--data-urlencode "repositoryId=icmcasedesign" \ | |
--data-urlencode "objectStore=CaseDesign" \ | |
--data-urlencode "serverName=https://vf2-cpe-stateless-svc:9443/wsi/FNCEWS40MTOM/" \ | |
--data-urlencode "protocol=FileNetP8WSI" \ | |
--data-urlencode "password=$userpw" \ | |
-X POST https://$cpdURL/icn/navigator/jaxrs/p8/logon --data-urlencode "userid=$userid" | awk '{ print substr( $0, 5 ) }' | jq . | |
##get case solutions list (working, need to login to FN first !!!) | |
curl -b icncookie.txt -c icncookie.txt -k -s -H "Authorization: Bearer $cpdToken" \ | |
-H "security_token: $icnSecToken" -H 'Content-Type: text/json' \ | |
-X POST "https://$cpdURL/icn/navigator/jaxrs/plugin?repositoryId=icmcasedesign&plugin=ICMAPIPlugin&action=GetSolutionList&desktop=baw" --data-raw '{"repositoryList":[{"objectStoreName":"CaseDesign"},{"objectStoreName":"OS01"}]}' | jq '.solutions[] | .solutionName , .solutionPrefix' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment