आपके पास किसी कंपनी का नाम या खोज शब्द है और आप स्वयं लुकअप बनाए बिना किसी एप्लिकेशन में कंपनी का डेटा जोड़ना चाहते हैं। यह गाइड बताती है कि नाम के आधार पर LiveMint API को कैसे कॉल करें, Python में लौटाए गए प्रोफ़ाइल फ़ील्ड कैसे पढ़ें, और दस्तावेज़ में दिए गए अनुरोध तथा प्रतिक्रिया के उदाहरणों के बीच अंतर को कैसे संभालें।
API क्या लौटाती है
LiveMint API का Get Company Data by Name एंडपॉइंट नाम का उपयोग करके किसी कंपनी का विस्तृत वित्तीय डेटा प्राप्त करता है। यह पूरे नाम, संक्षिप्त नाम और LiveMint खोज द्वारा समर्थित खोज शब्दों को स्वीकार करता है।
प्रकाशित प्रतिक्रिया के उदाहरण में कंपनी का नाम, उद्योग, कंपनी का विवरण, पहचानकर्ता, अधिकारी, एक्सचेंज कोड और वित्तीय मेट्रिक्स वाली समकक्ष कंपनियों की सूची शामिल है। ये फ़ील्ड कंपनी प्रोफ़ाइल पेज, शोध कार्यप्रवाह और ऐसे आंतरिक टूल के लिए उपयोगी हो सकते हैं जो कंपनी के नाम को संरचित जानकारी से समृद्ध करते हैं।
खोज शब्द हमेशा विशिष्ट पहचानकर्ता नहीं होते। किसी परिणाम को आंतरिक कंपनी रिकॉर्ड से जोड़ने से पहले, लौटाए गए कंपनी के नाम और अपने एप्लिकेशन के लिए प्रासंगिक पहचानकर्ताओं की जाँच करें।
Zyla API Hub पर शुरुआत करना
Zyla API Hub पर LiveMint API की लिस्टिंग खोलें, ज़रूरत पड़ने पर मुफ़्त खाता बनाएँ, और उपलब्ध होने पर Subscribe या Start Free Trial चुनें। लिस्टिंग से आप पहली API का 7-दिन का ट्रायल या 50-अनुरोध वाला विकल्प शुरू कर सकते हैं; मौजूदा एक्सेस विकल्पों और कीमतों के लिए API पेज देखें।
अपनी API key प्राप्त करें और उसे Authorization हेडर में bearer token के रूप में इस्तेमाल करें। Zyla प्रति-कॉल बिलिंग के बजाय सब्सक्रिप्शन और कोटा मॉडल का उपयोग करता है। key को ब्राउज़र कोड में एम्बेड करने के बजाय अपने सर्वर या किसी अन्य सुरक्षित वातावरण में रखें।
नाम से कंपनी का डेटा अनुरोध करें
उपलब्ध एंडपॉइंट Get Company Data by Name है। यह यहाँ GET अनुरोध स्वीकार करता है:
https://zylalabs.com/api/4204/livemint-api/5100/get-company-data-by-name
इसका आवश्यक क्वेरी पैरामीटर name है, जिसमें कंपनी का नाम या समर्थित खोज शब्द होता है। नीचे दिया गया प्रकाशित अनुरोध TCS खोजता है। इसे चलाने से पहले YOUR_API_KEY को अपनी Zyla API key से बदलें।
curl -s -X GET "https://zylalabs.com/api/4204/livemint-api/5100/get-company-data-by-name?name=TCS" \
-H "Authorization: Bearer YOUR_API_KEY"
Python से उसी एंडपॉइंट को कॉल करें
यह उदाहरण Python की मानक लाइब्रेरी का उपयोग करता है, HTTP या नेटवर्क त्रुटि की जाँच करता है, और प्रकाशित प्रतिक्रिया में दिखाए गए कंपनी तथा प्रोफ़ाइल फ़ील्ड पढ़ता है। यह यह मानकर नहीं चलता कि हर फ़ील्ड मौजूद होगा और अनुपलब्ध प्रोफ़ाइल को भी संभालता है।
import json
import os
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
url = "https://zylalabs.com/api/4204/livemint-api/5100/get-company-data-by-name?name=TCS"
api_key = os.environ["ZYLA_API_KEY"]
request = Request(
url,
headers={"Authorization": f"Bearer {api_key}"},
method="GET",
)
try:
with urlopen(request, timeout=30) as response:
data = json.load(response)
except HTTPError as error:
raise SystemExit(f"Request failed with HTTP status {error.code}")
except URLError as error:
raise SystemExit(f"Network request failed: {error.reason}")
except json.JSONDecodeError:
raise SystemExit("The response was not valid JSON")
if not isinstance(data, dict):
raise SystemExit("Expected a JSON object")
profile = data.get("companyProfile")
if not isinstance(profile, dict):
profile = {}
print("Company:", data.get("companyName"))
print("Industry:", data.get("industry"))
print("Description:", profile.get("companyDescription"))
print("Identifier:", profile.get("isInId"))
print("BSE code:", profile.get("exchangeCodeBse"))
print("NSE code:", profile.get("exchangeCodeNse"))
स्क्रिप्ट चलाने से पहले ZYLA_API_KEY एनवायरनमेंट वेरिएबल को अपनी key पर सेट करें। उदाहरण किसी मिलान को मानकर चलने के बजाय फ़ील्ड प्रिंट करता है: आपके एप्लिकेशन को यह सत्यापित करना चाहिए कि लौटाई गई कंपनी वही है जिसे उपयोगकर्ता ढूँढ़ रहा था।
प्रकाशित प्रतिक्रिया का उदाहरण पढ़ें
नीचे प्रकाशित प्रतिक्रिया का अंश दिया गया है। इसमें Zomato दिखता है, जबकि ऊपर दिया गया प्रकाशित अनुरोध TCS खोजता है; इस अंश को उस अनुरोध का अपेक्षित परिणाम न मानें। यह अंश अधूरा भी है, इसलिए इसे सीधे पार्स करने योग्य पूर्ण JSON दस्तावेज़ नहीं माना जा सकता।
{"companyName":"Zomato","industry":"Computer Services","companyProfile":{"companyDescription":"Zomato Limited operates as an Internet portal, which helps in connecting the users, restaurant partners/ third-party merchants and the delivery partners. The Company also provides a platform to restaurant partners/brands to advertise themselves to the target audience in India and abroad and supplies ingredients to restaurant partners. The Company’s India food ordering and delivery segment consists of an online marketplace platform through which the Company facilitates the listing and online ordering of food items and the delivery of these food items by connecting end users, restaurant partners and independent delivery partners. Its hyperpure supplies (B2B business) segment offers farm-to-fork supplies for restaurants in India. Its quick commerce segment consists of an online marketplace platform (Marketplace), which enables listing of items sold on the Marketplace by the sellers. The Company’s going-out segment is a combination of its dining-out and entertainment ticketing business.","mgIndustry":"Computer Services","isInId":"INE758T01015","officers":{"officer":[{"rank":1,"since":"01/18/2010","firstName":"Deepinder","mI":null,"lastName":"Goyal","age":"41","title":{"startYear":"2021","startMonth":"3","startDay":"24","iD1":"CEO","abbr1":"CEO","iD2":"FDR","abbr2":"Fndr.","Value":"Chief Executive Officer, Founder, Managing Director, Executive Director"}},{"rank":2,"since":"11/09/2020","firstName":"Akshant","mI":null,"lastName":"Goyal","age":null,"title":{"startYear":"2020","startMonth":"11","startDay":"9","iD1":"CFO","abbr1":"CFO","iD2":"","abbr2":"","Value":"Chief Financial Officer"}},{"rank":3,"since":"01/21/2019","firstName":"Sandhya","mI":null,"lastName":"Sethia","age":null,"title":{"startYear":"2022","startMonth":"3","startDay":"","iD1":"CCO","abbr1":"Chief Comp.","iD2":"SEC","abbr2":"Secy.","Value":"Company Secretary and Compliance Officer"}}]},"exchangeCodeBse":"543320","exchangeCodeNse":"ZOMATO","peerCompanyList":[{"tickerId":"S0003105","companyName":"Wipro","priceToBookValueRatio":3.87,"priceToEarningsValueRatio":24.88,"marketCap":276762.16,"price":264.3,"percentChange":-1.53,"netChange":-4.1,"returnOnAverageEquity5YearAverage":17.18,"returnOnAverageEquityTrailing12Month":15.66,"ltDebtPerEquityMostRecentFiscalYear":10.17,"netProfitMargin5YearAverage":14.48,"netProfitMarginPercentTrailing12Month":14.06,"dividendYieldIndicatedAnnualDividend":2.16,"totalSharesO…
प्रोफ़ाइल स्क्रीन के लिए companyName, industry और companyProfile.companyDescription से शुरुआत करें। उदाहरण में isInId और एक्सचेंज कोड भी companyProfile के भीतर हैं; मिलान सहेजने से पहले उपयोगकर्ता को कंपनी की पुष्टि करने में मदद के लिए इन फ़ील्ड का उपयोग करें।
उदाहरण के officers.officer ऐरे में नाम और पद हैं, जबकि peerCompanyList में समकक्ष कंपनियों के नाम और मेट्रिक्स हैं। कुछ अधिकारी मान null या खाली स्ट्रिंग हैं, इसलिए हर रिकॉर्ड को पूर्ण मानने के बजाय उन्हें अनुपलब्ध के रूप में दिखाएँ।
इस अंश से समकक्ष कंपनियों के मेट्रिक्स की इकाइयाँ, मुद्रा या अपडेट का समय पता नहीं चलता। इन संख्याओं को इकाइयों के साथ दिखाने या मौजूदा बाज़ार डेटा मानने से पहले API पेज देखें। इसी तरह, दस्तावेज़ में दिए गए रिफ़्रेश अंतराल को मान लेने के बजाय अपनी ताज़गी संबंधी ज़रूरतों के अनुसार एप्लिकेशन-साइड कैश की अवधि चुनें।
व्यावहारिक उपयोग और AI एजेंट की पहुँच
कंपनी शोध टूल नाम स्वीकार कर सकता है, प्रोफ़ाइल प्राप्त कर सकता है और लौटाए गए पहचानकर्ता तथा एक्सचेंज कोड के साथ विवरण दिखा सकता है। विश्लेषक इसे शोध रिकॉर्ड में जोड़ने से पहले मिलान की पुष्टि कर सकता है।
आंतरिक डेटा-समृद्धि कार्यप्रवाह उपयोगकर्ता द्वारा दर्ज की गई कंपनी के लिए समीक्षा स्क्रीन भरने हेतु इसी लुकअप का उपयोग कर सकता है। मूल खोज शब्द और लौटाए गए कंपनी के नाम को अलग-अलग रखें: संक्षिप्त नाम के लिए परिणाम को मौजूदा रिकॉर्ड से जोड़ने से पहले मानवीय समीक्षा की ज़रूरत हो सकती है।
AI एजेंट के लिए, https://mcp.zylalabs.com/mcp?apikey=YOUR_API_KEY के साथ संगत क्लाइंट कॉन्फ़िगर करें। Zyla का MCP एंडपॉइंट Claude Code, Cursor, Windsurf और अन्य MCP-संगत क्लाइंट के साथ काम करता है। कंपनी लुकअप का अनुरोध करने के लिए क्लाइंट के उपलब्ध टूल का उपयोग करें और एजेंट से परिणाम इस्तेमाल करने से पहले लौटाए गए नाम की जाँच करवाएँ।
अक्सर पूछे जाने वाले प्रश्न
क्या मैं कंपनी के संक्षिप्त नाम से खोज सकता हूँ?
हाँ। एंडपॉइंट पूरे नाम, संक्षिप्त नाम और LiveMint खोज द्वारा समर्थित खोज शब्दों को स्वीकार करता है। यदि किसी खोज शब्द से एक से अधिक कंपनियाँ मिल सकती हैं, तो लौटाए गए नाम और पहचानकर्ताओं की जाँच करें।
एंडपॉइंट को कॉल करने के लिए क्या आवश्यक है?
आवश्यक name क्वेरी पैरामीटर और Authorization: Bearer YOUR_API_KEY हेडर के साथ GET अनुरोध भेजें। अनुरोध करने से पहले लिस्टिंग पर सब्सक्राइब करें या उपलब्ध ट्रायल शुरू करें।
प्रतिक्रिया के उदाहरण में अनुरोध से अलग कंपनी क्यों दिखाई गई है?
प्रकाशित अनुरोध में TCS का उपयोग है, जबकि प्रकाशित प्रतिक्रिया के अंश में Zomato दिखता है। इस अंश का उपयोग दिखाए गए फ़ील्ड समझने के लिए करें, न कि यह दावा मानने के लिए कि अनुरोध से यही परिणाम मिलेगा।
क्या मैं प्रकाशित प्रतिक्रिया के अंश को JSON के रूप में पार्स कर सकता हूँ?
नहीं। यह अंश समकक्ष कंपनी के डेटा के बीच में समाप्त हो जाता है। इसके बजाय अपने अनुरोध से मिली पूरी प्रतिक्रिया को पार्स करें और अपने एप्लिकेशन में अनुपलब्ध या null मानों को संभालें।
कंपनी के नाम से लुकअप को एकीकृत करने के लिए तैयार हैं? मुफ़्त Zyla खाता बनाएँ, API key प्राप्त करें और LiveMint API का 7-दिन का ट्रायल शुरू करें। मौजूदा एक्सेस विकल्पों, कीमतों और कोटा के विवरण के लिए लिस्टिंग देखें।
आधिकारिक API प्रतिक्रिया
{"companyName":"Zomato","industry":"Computer Services","companyProfile":{"companyDescription":"Zomato Limited operates as an Internet portal, which helps in connecting the users, restaurant partners/ third-party merchants and the delivery partners. The Company also provides a platform to restaurant partners/brands to advertise themselves to the target audience in India and abroad and supplies ingredients to restaurant partners. The Company’s India food ordering and delivery segment consists of an online marketplace platform through which the Company facilitates the listing and online ordering of food items and the delivery of these food items by connecting end users, restaurant partners and independent delivery partners. Its hyperpure supplies (B2B business) segment offers farm-to-fork supplies for restaurants in India. Its quick commerce segment consists of an online marketplace platform (Marketplace), which enables listing of items sold on the Marketplace by the sellers. The Company’s going-out segment is a combination of its dining-out and entertainment ticketing business.","mgIndustry":"Computer Services","isInId":"INE758T01015","officers":{"officer":[{"rank":1,"since":"01/18/2010","firstName":"Deepinder","mI":null,"lastName":"Goyal","age":"41","title":{"startYear":"2021","startMonth":"3","startDay":"24","iD1":"CEO","abbr1":"CEO","iD2":"FDR","abbr2":"Fndr.","Value":"Chief Executive Officer, Founder, Managing Director, Executive Director"}},{"rank":2,"since":"11/09/2020","firstName":"Akshant","mI":null,"lastName":"Goyal","age":null,"title":{"startYear":"2020","startMonth":"11","startDay":"9","iD1":"CFO","abbr1":"CFO","iD2":"","abbr2":"","Value":"Chief Financial Officer"}},{"rank":3,"since":"01/21/2019","firstName":"Sandhya","mI":null,"lastName":"Sethia","age":null,"title":{"startYear":"2022","startMonth":"3","startDay":"","iD1":"CCO","abbr1":"Chief Comp.","iD2":"SEC","abbr2":"Secy.","Value":"Company Secretary and Compliance Officer"}}]},"exchangeCodeBse":"543320","exchangeCodeNse":"ZOMATO","peerCompanyList":[{"tickerId":"S0003105","companyName":"Wipro","priceToBookValueRatio":3.87,"priceToEarningsValueRatio":24.88,"marketCap":276762.16,"price":264.3,"percentChange":-1.53,"netChange":-4.1,"returnOnAverageEquity5YearAverage":17.18,"returnOnAverageEquityTrailing12Month":15.66,"ltDebtPerEquityMostRecentFiscalYear":10.17,"netProfitMargin5YearAverage":14.48,"netProfitMarginPercentTrailing12Month":14.06,"dividendYieldIndicatedAnnualDividend":2.16,"totalSharesO…
आधिकारिक API प्रतिक्रिया
{"companyName":"Zomato","industry":"Computer Services","companyProfile":{"companyDescription":"Zomato Limited operates as an Internet portal, which helps in connecting the users, restaurant partners/ third-party merchants and the delivery partners. The Company also provides a platform to restaurant partners/brands to advertise themselves to the target audience in India and abroad and supplies ingredients to restaurant partners. The Company’s India food ordering and delivery segment consists of an online marketplace platform through which the Company facilitates the listing and online ordering of food items and the delivery of these food items by connecting end users, restaurant partners and independent delivery partners. Its hyperpure supplies (B2B business) segment offers farm-to-fork supplies for restaurants in India. Its quick commerce segment consists of an online marketplace platform (Marketplace), which enables listing of items sold on the Marketplace by the sellers. The Company’s going-out segment is a combination of its dining-out and entertainment ticketing business.","mgIndustry":"Computer Services","isInId":"INE758T01015","officers":{"officer":[{"rank":1,"since":"01/18/2010","firstName":"Deepinder","mI":null,"lastName":"Goyal","age":"41","title":{"startYear":"2021","startMonth":"3","startDay":"24","iD1":"CEO","abbr1":"CEO","iD2":"FDR","abbr2":"Fndr.","Value":"Chief Executive Officer, Founder, Managing Director, Executive Director"}},{"rank":2,"since":"11/09/2020","firstName":"Akshant","mI":null,"lastName":"Goyal","age":null,"title":{"startYear":"2020","startMonth":"11","startDay":"9","iD1":"CFO","abbr1":"CFO","iD2":"","abbr2":"","Value":"Chief Financial Officer"}},{"rank":3,"since":"01/21/2019","firstName":"Sandhya","mI":null,"lastName":"Sethia","age":null,"title":{"startYear":"2022","startMonth":"3","startDay":"","iD1":"CCO","abbr1":"Chief Comp.","iD2":"SEC","abbr2":"Secy.","Value":"Company Secretary and Compliance Officer"}}]},"exchangeCodeBse":"543320","exchangeCodeNse":"ZOMATO","peerCompanyList":[{"tickerId":"S0003105","companyName":"Wipro","priceToBookValueRatio":3.87,"priceToEarningsValueRatio":24.88,"marketCap":276762.16,"price":264.3,"percentChange":-1.53,"netChange":-4.1,"returnOnAverageEquity5YearAverage":17.18,"returnOnAverageEquityTrailing12Month":15.66,"ltDebtPerEquityMostRecentFiscalYear":10.17,"netProfitMargin5YearAverage":14.48,"netProfitMarginPercentTrailing12Month":14.06,"dividendYieldIndicatedAnnualDividend":2.16,"totalSharesO…