तो अंत बिंदु वास्तव में .xls फ़ाइल लिए एक सीधा लिंक है, तो आप को डाउनलोड करने को संभालने के लिए निम्नलिखित कोड की कोशिश कर सकते हैं:
public static boolean download(final File output, final String source) {
try {
if (!output.createNewFile()) {
throw new RuntimeException("Could not create new file!");
}
URL url = new URL(source);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// Comment in the code in the following line in case the endpoint redirects instead of it being a direct link
// connection.setInstanceFollowRedirects(true);
connection.setRequestProperty("AUTH-KEY-PROPERTY-NAME", "yourAuthKey");
final ReadableByteChannel rbc = Channels.newChannel(connection.getInputStream());
final FileOutputStream fos = new FileOutputStream(output);
fos.getChannel().transferFrom(rbc, 0, 1 << 24);
fos.close();
return true;
} catch (final Exception e) {
e.printStackTrace();
}
return false;
}
तुम सब चाहिए करने की ज़रूरत उचित नाम के लिए निर्धारित है प्रमाणीकरण टोकन और उस में भरने
उदाहरण उपयोग:।
download(new File("C:\\output.xls"), "http://www.website.com/endpoint");
पोस्टमैन ऐसा एप्लिकेशन नहीं है जिसे आप "प्रोग्रामेटिकली" का उपयोग कर सकते हैं - यह एक पूर्ण-विशेषीकृत जीयूआई है। "POSTMAN का उपयोग कर डाउनलोड की गई .xls फ़ाइल को देखने" का क्या मतलब है? क्या आप पोस्टमैन का उपयोग करके एंडपॉइंट पर कॉल करना चाहते हैं? – nbokmans
@nbokmans मैं बैकएंड जब मैं डाकिया का उपयोग द्वारा प्रदान की .xls फ़ाइल डाउनलोड करना चाहते, मैं ठीक से अपने सभी unicodes और विशेष वर्ण .xls फ़ाइल को देखने के लिए, नहीं पा रहा हूँ। तो एक API फायरिंग और मेरे पीसी – prasshant
अभी भी पर्याप्त सूचना नहीं है यही कारण है कि पर .xls फ़ाइल डाउनलोड करने के लिए डाकिया से वहाँ किसी भी अन्य कार्यक्रम संबंधी रास्ता अलग, मैं क्या जरूरत है - अंत बिंदु या यह करता है से फ़ाइल डाउनलोड करने यूआरएल आप के साथ प्रदान करता है वास्तव में डाउनलोड शुरू करें? जैसे यदि आप अंत बिंदु पर जाते हैं, आप JSON/XML/जो कुछ डेटा है कि आपको बताता है कि जहां फ़ाइल स्थित है या उसे सीधे डाउनलोड शुरू करता मिलता है? – nbokmans