cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Zip file using rest services

vijimechanical
4-Participant

Zip file using rest services

I need a custom services to hit external API which provides ZIP File (contains pdfs files) as response and display those pdf files in mashup.

@PaiChung 

4 REPLIES 4

I've never done this, but there is a LoadBinary service in the contentloader functions, you can try that and then save that to the filerepository as zip, and then use the unzip command on the filerepository

after that do a getfilelisting to display the link in a webframe widget.

@PaiChung 

 

i tried LoadBinary service in the contentloader functions and saved the response as zip file. But zip file not saved properly. i suspect issue in receiving binary response. 

 

Can you share sample code to receive zip file as binary response?

 

Regards, 

Vijay

Sorry I do not have any code example.

Hi @vijimechanical, I believe there are many possible reasons that could cause a failed GET.

As you may have known, the basic version is as follows:

var params = {
	proxyScheme: undefined /* STRING */,
	headers: undefined /* JSON */,
	ignoreSSLErrors: undefined /* BOOLEAN */,
	useNTLM: undefined /* BOOLEAN */,
	workstation: undefined /* STRING */,
	useProxy: undefined /* BOOLEAN */,
	proxyHost: undefined /* STRING */,
	url: "http://external-site/download.zip" /* STRING */,
	timeout: undefined /* NUMBER */,
	proxyPort: undefined /* INTEGER */,
	password: undefined /* STRING */,
	domain: undefined /* STRING */,
	username: undefined /* STRING */
};

// result: BLOB
var result = Resources["ContentLoaderFunctions"].LoadBinary(params);

I believe you can share the error details found in the script logs.

Announcements


Top Tags