DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
This topic has been marked "Resolved."
Author Message
venkata9



Group memberships:
Premium Members

Joined: 18 Sep 2017
Posts: 7

Points: 261

Post Posted: Tue Sep 19, 2017 7:25 pm Reply with quote    Back to top    

DataStage® Release: 11x
Job Type: Parallel
OS: Unix
Hi All,

I recently signed up for premium member but unfortunately i could not create a new post. so i'm posting my query here.


I'm trying to automate to run IGC data lineagre report using REST API and save to a pdf file. below is the script which I created to extract the RID of a given string and download the data lineage report. But i'm not able get #3 working (generate PDF)

so could some one please help me ?



below is my script for V11.5.0.2

#!/bin/sh
#execution of the script

if [ -z "$1" ]
then
echo "Usage: `basename $0` {input string}"
else
#--> 1)Searching for the RID
Asset_Id=`curl -sS -k -u user:***** -X GET https://host/ibm/iis/igc-rest/v1/search/?types=bi_collection |grep -B 1 "$1"|grep -w _id|tr ' ' '\0'|cut -d: -f4|cut -d, -f1 |tr -d '"'`
if [ -z "${Asset_Id}" ]
then
echo "No such string please try again"
echo "program terminating"
exit 0
fi
echo "${Asset_Id}"

#--> 2)Creating Jason Construct

echo "creating Json Construct to Run the Lineage"
echo "{
"assetId":"${Asset_Id}",
"fileType":"PDF"
}" >> /tmp/sample123.json

#--> 3)processing the rid to download the PDF file

curl -sS -v -k -u user:**** -X POST -H "Content-Type:application/json" -d /tmp/sample123.json https://host/ibm/iis/igc-rest/v1/flows/report

rm -rf /tmp/sample123.json
fi



-----------------------------------------------------------------------------



below is the output



/igc_sample.sh AGGREGATION_L1_RECON_ACBS_COMBINED
739c39a2.cf18a8a.07j5qe5v9.5t5i2h4.8m427t.bfl2e0q22ugggfkpp1j259

* About to connect() to *****HOST*******
* Trying *******... connected
* Connected to ****HOST**
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* warning: ignoring value of ssl.verifyhost
* skipping SSL peer certificate verification
* SSL connection using TLS_DHE_RSA_WITH_AES_128_CBC_SHA
* Server certificate:
* subject: CN=******,OU=****,O=***** Group,L=*****,ST=***,C=****
* start date: May 14 15:39:07 2017 GMT
* expire date: May 10 15:39:07 2032 GMT
* common name: ******
* issuer: CN=******,OU=***,O=***** Group,******
* Server auth using Basic with user '********'
> POST /ibm/iis/igc-rest/v1/flows/report HTTP/1.1
> Authorization: Basic *********************==
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.16.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: ****HOST*****
> Accept: */*
> Content-Type:application/json
> Content-Length: 19
>
< HTTP/1.1 400 Bad Request
< X-Powered-By: Servlet/3.0
< Cache-Control: no-cache
< Pragma: no-cache
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< X-Frame-Options: SAMEORIGIN
< Content-Language: en-US
< Content-Length: 0
< Set-Cookie: LtpaToken2=******* ; Secure; HttpOnly
< Set-Cookie: JSESSIONID=**********; Path=/; Secure; HttpOnly
< Set-Cookie: X-IBM-IISSessionId=*********; Path=/; Secure; HttpOnly
< Connection: Close
< Date: Wed, 20 Sep 2017 00:42:20 GMT
<
* Closing connection #0

_________________
Venkata

Last edited by venkata9 on Tue Sep 19, 2017 9:01 pm; edited 3 times in total
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 42221
Location: Denver, CO
Points: 216780

Post Posted: Tue Sep 19, 2017 7:36 pm Reply with quote    Back to top    

Not really sure what one has to do with the other but here you go, busted out into your own post. Had to guess at the version (etc) feel free to edit them if need be.

_________________
-craig

Watch out where the huskies go and don't you eat that yellow snow
Rate this response:  
venkata9



Group memberships:
Premium Members

Joined: 18 Sep 2017
Posts: 7

Points: 261

Post Posted: Tue Sep 19, 2017 9:13 pm Reply with quote    Back to top    

Hi,

thanks for making this as separate thread.

i'm having troubles with running the below "IGC REST API on Infosphere V11.5.0.2" (Redhat Linux)



curl -sS -v -k -u user:password -X POST -H "Content-Type:application/json" -d /tmp/sample123.json https://host/ibm/iis/igc-rest/v1/flows/report

where /tmp/sample123.json is as follows

{
"assetId":"${Asset_Id}",
"fileType":"PDF"
}"



below is this the log/output i'm getting.



below is the output when run the above REST API using curl.


* About to connect() to *****HOST*******
* Trying *******... connected
* Connected to ****HOST**
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* warning: ignoring value of ssl.verifyhost
* skipping SSL peer certificate verification
* SSL connection using TLS_DHE_RSA_WITH_AES_128_CBC_SHA
* Server certificate:
* subject: CN=******,OU=****,O=***** Group,L=*****,ST=***,C=****
* start date: May 14 15:39:07 2017 GMT
* expire date: May 10 15:39:07 2032 GMT
* common name: ******
* issuer: CN=******,OU=***,O=***** Group,******
* Server auth using Basic with user '********'
> POST /ibm/iis/igc-rest/v1/flows/report HTTP/1.1
> Authorization: Basic *********************==
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.16.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: ****HOST*****
> Accept: */*
> Content-Type:application/json
> Content-Length: 19
>
< HTTP/1.1 400 Bad Request
< X-Powered-By: Servlet/3.0
< Cache-Control: no-cache
< Pragma: no-cache
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< X-Frame-Options: SAMEORIGIN
< Content-Language: en-US
< Content-Length: 0
< Set-Cookie: LtpaToken2=******* ; Secure; HttpOnly
< Set-Cookie: JSESSIONID=**********; Path=/; Secure; HttpOnly
< Set-Cookie: X-IBM-IISSessionId=*********; Path=/; Secure; HttpOnly
< Connection: Close
< Date: Wed, 20 Sep 2017 00:42:20 GMT
<
* Closing connection #0

Thanks. [/b]

_________________
Venkata
Rate this response:  
Not yet rated
eostic

Premium Poster



Group memberships:
Premium Members

Joined: 17 Oct 2005
Posts: 3717

Points: 29679

Post Posted: Wed Sep 20, 2017 3:59 am Reply with quote    Back to top    

Hi. I haven't had a chance to work with this call using curl. I'm not "exactly" sure whether it is possible, but I don't know all the options and details that curl provides. I suspect that ...

_________________
Ernie Ostic

blogit!
Open IGC is Here!
Rate this response:  
venkata9



Group memberships:
Premium Members

Joined: 18 Sep 2017
Posts: 7

Points: 261

Post Posted: Mon Sep 25, 2017 1:16 pm Reply with quote    Back to top    

Hi,

this issue is resolved. its Curl syntax error i.e i need to @ with -d option

curl -sS -v -k -u user:**** -X POST -H "Content-Type:application/json" -d @/tmp/sample123.json https://host/ibm/iis/igc-rest/v1/flows/report


Thanks,
Venkata

_________________
Venkata
Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours