open and download few files from a zip folder through JFrog artifactory http linkHi,
I want to read few files from zip folder through JFrog artifactory http link. I 'm not quite sure how I can solve the issue below:
1) user and password needed when access the link
2) the script I used could have issue that it gave me error
The link I try to access looks like below ( created a fake one to show how it looks like )
http://docker-virtual.artifactory.xxx.com:80/ui/repos/tree/General/Sxxxx/logs/ABC/1111_23456_1_test.zip
below is a draft of script I put together but it doesnt work. I was told I can create API key that can be used to bypass the user and password for sign in but not able to make it work. Can someone help me out here?
</CODE></DIR></PRE><P> </P><P> </P><P> </P><P> </P></LINGO-BODY><LINGO-LABS id="lingo-labs-683976" slang="en-US" mode="NONE"><LINGO-LABEL>Automation and Scripting</LINGO-LABEL><LINGO-LABEL>Data Access</LINGO-LABEL></LINGO-LABS><LINGO-SUB id="lingo-sub-684133" slang="en-US" mode="NONE">Re: open and download few files from a zip folder through JFrog artifactory http link</LINGO-SUB><LINGO-BODY id="lingo-body-684133" slang="en-US" mode="NONE"><P><A href="https://community.jmp.com/t5/Uncharted/YouTube-API/m-p/400049#U400049" class="lia-mention-container-editor-message lia-img-icon-blog-thread lia-fa-icon lia-fa-blog lia-fa-thread lia-fa" target="_blank">YouTube API</A> shows one way an api key might work. Did the documentation they supplied tell you how to supply the one you received?</P></LINGO-BODY><LINGO-SUB id="lingo-sub-684168" slang="en-US" mode="NONE">Re: open and download few files from a zip folder through JFrog artifactory http link</LINGO-SUB><LINGO-BODY id="lingo-body-684168" slang="en-US" mode="NONE"><P> </P><P><SPAN>To deploy the file using </SPAN><SPAN class=""><STRONG>API Key</STRONG></SPAN><SPAN> in a header, you would use the following command:</SPAN></P><PRE class=""><CODE>curl -H "X-JFrog-Art-Api:ABcdEF" -X PUT "http://localhost:8081/artifactory/my-repository/my/new/artifact/directory/file.txt" -T Desktop/myNewFile.txtrequest = NewHTTPRequest(
URL( "http://http://docker-virtual.artifactory.xxx.com:80/ui/repos/tree/General/Sxxxx/logs/ABC/1111_23456_1_test.zip" ),
Method( "GET" ),
);
zip = request << Send;
za=open(zip,"zip");
zipfiles=za<
Re: open and download few files from a zip folder through JFrog artifactory http linkCraige,
1) Can we still using the open() to open zip folder and download specific file through webpage?
2) Can we open and read one of the file in the zip folder through page and get only some text out of it?
Re: open and download few files from a zip folder through JFrog artifactory http linkCurl's -H specifies a header, which requires you to use New HTTP Request. open() can add a query string but can't add headers, so it won't do what you need.
help->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting indexhelp->scripting index
I think you'll need
headers({"X-JFrog-Art-Api:ABcdEF"})
but not the query string and fields.
Once you get the zip file, you can use JMP's zip archive support to get the unzipped members.
You might use download rather than send:
download a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a filedownload a file
@bryan_boone
Re: open and download few files from a zip folder through JFrog artifactory http linkIf I use the download, will it download the whole zip? I dont want the whole zip file because it is huge. I want to open the zip folder and just get the files I wanted.
Re: open and download few files from a zip folder through JFrog artifactory http linkYes, it downloads the whole zip file, not a member. Unless the API has a method to get the smaller chunk, you'll need to get it all and only unzip what you need. Many APIs allow for what you are trying to do by making a custom zip file of just the items you want. You might have to do some reading in the API doc to puzzle it out.
Re: open and download few files from a zip folder through JFrog artifactory http linkAlso, your example is a PUT, not a GET. You probably picked up the PUT example from part of the doc that puts new data into the database. There is probably a GET example for getting old data from the database. GET and PUT are part of the way a REST-ful server works, and there are other verbs too.
<script src="
https://community.jmp.com/ui/js/chunk-vendors.61f2dc48.js">
request = NewHTTPRequest(
URL( "http://http://docker-virtual.artifactory.xxx.com:80/ui/repos/tree/General/Sxxxx/logs/ABC/1111_23456_1_test.zip/test.log" ),
Method( "GET" ),
headers({"X-JFrog-Art-Api: API-Key"})
);
zip = request << download("D:\temp.log", "replace", "show_progress");
<script src="
https://community.jmp.com/ui/js/chunk-vendors.61f2dc48.js">
request = NewHTTPRequest(
URL( "http://http://docker-virtual.artifactory.xxx.com:80/ui/repos/tree/General/Sxxxx/logs/ABC/1111_23456_1_test.zip/test.log" ),
Method( "GET" ),
headers({"X-JFrog-Art-Api: API-Key"})
);
zip = request << download("D:\temp.log", "replace", "show_progress");
<script src="
https://community.jmp.com/ui/js/chunk-vendors.61f2dc48.js">
request = NewHTTPRequest(
URL( "http://http://docker-virtual.artifactory.xxx.com:80/ui/repos/tree/General/Sxxxx/logs/ABC/1111_23456_1_test.zip/test.log" ),
Method( "GET" ),
headers({"X-JFrog-Art-Api: API-Key"})
);
zip = request << download("D:\temp.log", "replace", "show_progress");
<script src="
https://community.jmp.com/ui/js/chunk-vendors.61f2dc48.js">
request = NewHTTPRequest(
URL( "http://http://docker-virtual.artifactory.xxx.com:80/ui/repos/tree/General/Sxxxx/logs/ABC/1111_23456_1_test.zip/test.log" ),
Method( "GET" ),
headers({"X-JFrog-Art-Api: API-Key"})
);
zip = request << download("D:\temp.log", "replace", "show_progress");
<script src="
https://community.jmp.com/ui/js/chunk-vendors.61f2dc48.js">
request = NewHTTPRequest(
URL( "http://http://docker-virtual.artifactory.xxx.com:80/ui/repos/tree/General/Sxxxx/logs/ABC/1111_23456_1_test.zip/test.log" ),
Method( "GET" ),
headers({"X-JFrog-Art-Api: API-Key"})
);
zip = request << download("D:\temp.log", "replace", "show_progress");
<script src="
https://community.jmp.com/ui/js/chunk-vendors.61f2dc48.js">
request = NewHTTPRequest(
URL( "http://http://docker-virtual.artifactory.xxx.com:80/ui/repos/tree/General/Sxxxx/logs/ABC/1111_23456_1_test.zip/test.log" ),
Method( "GET" ),
headers({"X-JFrog-Art-Api: API-Key"})
);
zip = request << download("D:\temp.log", "replace", "show_progress");
<script src="
https://community.jmp.com/ui/js/chunk-vendors.61f2dc48.js">
request = NewHTTPRequest(
URL( "http://http://docker-virtual.artifactory.xxx.com:80/ui/repos/tree/General/Sxxxx/logs/ABC/1111_23456_1_test.zip/test.log" ),
Method( "GET" ),
headers({"X-JFrog-Art-Api: API-Key"})
);
zip = request << download("D:\temp.log", "replace", "show_progress");
Re: open and download few files from a zip folder through JFrog artifactory http linknot success. I found that there are 2 options for using api key for authentication and download file from artifactory:
1) curl -uadmin:API-Key -ocommons-collections-3.1.jar http://localhost:8081/artifactory/jcenter/apache-collections/commons-collections/3.1/commons-collections-3.1.jar
2) curl -H "X-JFrog-Art-Api: API-Key" -ocommons-collections-3.1.jar http://localhost:8081/artifactory/jcenter/apache-collections/commons-collections/3.1/commons-collections-3.1.jar
I tried the 2) in script below because of the use of header, but it didnt download the file, but some strange character which I posted at below. I 'm not sure where it went wrong.
temp.log file with information below instead of the content from the url
<meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content=""IE=edge"" /><meta name="viewport" content=""width=device-width,initial-scale=1"" /><meta name="importmap-type" content="systemjs-importmap" /><script type="systemjs-importmap" src="https://community.jmp.com/ui/imports-map/imports.json">JFrog@keyframes heartbeatOut{from{opacity:1}50%{opacity:0;transform:scale(.8)}to{opacity:0;transform:scale(.8)}}@keyframes heartbeat{from{transform:scale3d(1,1,1)}50%{transform:scale3d(1.15,1.15,1.15)}to{transform:scale3d(1,1,1)}}.pounding-heart-container{display:none;align-items:center;justify-content:center;position:absolute;left:0;right:0;top:0;bottom:0;z-index:9999999999;background:linear-gradient(132.49deg,#414857 14.17%,#252831 83.36%)}.pounding-heart-container.show-splash{display:flex}.logo{width:130px;-webkit-backface-visibility:hidden;-ms-transform:translateZ(0);-webkit-transform:translateZ(0);transform:translateZ(0)}.logo.pulse{animation:heartbeat 1.7s infinite}.logo.zoom-out{animation:heartbeatOut 150ms forwards}

<script src="
https://community.jmp.com/ui/js/chunk-vendors.61f2dc48.js">
request = NewHTTPRequest(
URL( "http://http://docker-virtual.artifactory.xxx.com:80/ui/repos/tree/General/Sxxxx/logs/ABC/1111_23456_1_test.zip/test.log" ),
Method( "GET" ),
headers({"X-JFrog-Art-Api: API-Key"})
);
zip = request << download("D:\temp.log", "replace", "show_progress");
Re: open and download few files from a zip folder through JFrog artifactory http linkHi Craige,
I found the issue and get it fixed. The problem is from the URL. replacing "ui/repos/tree/General" with "artifactory" and then I able to download the whole zip file, not the specific file.
Thanks for your help