Company API
API change historyA collection of RESTful methods that returns various financial data for a requested company including balance sheets, stock quotes , company look-up utilities and more.
Balance Sheet
Returns a company's most recent balance sheet summarizing their liabilities, assets and shareholders' equity.
Try itRequest
Request URL
Request parameters
-
string
Publicly traded company's stock symbol
-
(optional)string
Annual (10-K) or Quarterly (10-Q)
-
(optional)number
Retrieve an older financial statement by specifying number of filings to go back. For example, to retrieve the second to most recent filing, specify a filingOrder value of 1. By default, the most recent filing is returned (filingOrder = 0)
Request headers
Request body
Responses
200 OK
Financial statement found. Keys in Data element varies per company and year of filing based on US GAAP Financial Reporting Taxonomy - http://www.fasb.org/jsp/FASB/Page/LandingPage&cid=1176164131053
Representations
{
"Status":0,
"Name":"Balance Sheets",
"CIK":"789019",
"Company":"MICROSOFT CORP",
"AccessionNumber":"0001193125-14-289961",
"Source":"10-K",
"FilingDate":"2014-07-31T17:16:52",
"FilingCount":5,
"Data":{
"CashAndCashEquivalentsAtCarryingValue":8669000000.0,
"AvailableForSaleSecuritiesCurrent":77040000000.0,
"CashCashEquivalentsAndShortTermInvestments":85709000000.0,
"AccountsReceivableNetCurrent":19544000000.0,
"InventoryNet":2660000000.0,
"DeferredTaxAssetsLiabilitiesNetCurrent":1941000000.0,
"OtherAssetsCurrent":4392000000.0,
"AssetsCurrent":114246000000.0,
"PropertyPlantAndEquipmentNet":13011000000.0,
"LongTermInvestments":14597000000.0,
"Goodwill":20127000000.0,
"FiniteLivedIntangibleAssetsNet":6981000000.0,
"OtherAssetsNoncurrent":3422000000.0,
"Assets":172384000000.0,
"AccountsPayableCurrent":7432000000.0,
"ShortTermBorrowings":2000000000.0,
"LongTermDebtCurrent":0.0,
"EmployeeRelatedLiabilitiesCurrent":4797000000.0,
"AccruedIncomeTaxesCurrent":782000000.0,
"DeferredRevenueCurrent":23150000000.0,
"DepositsReceivedForSecuritiesLoanedAtCarryingValue":558000000.0,
"OtherLiabilitiesCurrent":6906000000.0,
"LiabilitiesCurrent":45625000000.0,
"LongTermDebtNoncurrent":20645000000.0,
"DeferredRevenueNoncurrent":2008000000.0,
"DeferredTaxLiabilitiesNoncurrent":2728000000.0,
"OtherLiabilitiesNoncurrent":11594000000.0,
"Liabilities":82600000000.0,
"CommonStocksIncludingAdditionalPaidInCapital":68366000000.0,
"RetainedEarningsAccumulatedDeficit":17710000000.0,
"AccumulatedOtherComprehensiveIncomeLossNetOfTax":3708000000.0,
"StockholdersEquity":89784000000.0,
"LiabilitiesAndStockholdersEquity":172384000000.0
},
"Content":"<html><head></head><body><table class=\"report\" style=\"background-color: #fff;clear: both;color: #000;font: 8pt Helvetica,Arial,san-serif;margin-bottom: 2em\" border=\"0\" cellspacing=\"2\" id=\"ID0EQWAG\"> <tbody><tr> <th class=\"tl\" style=\"background-color: #600;color: #fff;font-weight: 700;text-align: center;font-size: 8pt\" colspan=\"1\" rowspan=\"1\"> <div style=\"width: 200px;\"><strong>BALANCE SHEETS (USD $)<br>In Millions, unless otherwise specified</strong></div> </th> <th class=\"th\" style=\"background-color: #600;color: #fff;font-weight: 700;text-align: center;font-size: 8pt\"> <div>Jun. 30, 2014</div> </th> <th class=\"th\" style=\"background-color: #600;color: #fff;font-weight: 700;text-align: center;font-size: 8pt\"> <div>Jun. 30, 2013</div> </th> </tr> <tr class=\"re\" style=\"background-color: #EAEAEA\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\"><strong>Current assets:</strong></td> <td class=\"text\" style=\"text-align: left;white-space: normal\"> <span></span></td> <td class=\"text\" style=\"text-align: left;white-space: normal\"> <span></span></td> </tr> <tr class=\"ro\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Cash and Cash Equivalents</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">$ 8,669<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">$ 3,804<span></span></td> </tr> <tr class=\"re\" style=\"background-color: #EAEAEA\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Short-term investments (including securities loaned of $541 and $579)</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">77,040<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">73,218<span></span></td> </tr> <tr class=\"rou\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Total cash, cash equivalents, and short-term investments</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em;border-bottom: 1px solid #000\">85,709<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em;border-bottom: 1px solid #000\">77,022<span></span></td> </tr> <tr class=\"re\" style=\"background-color: #EAEAEA\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Accounts receivable, net of allowance for doubtful accounts of $301 and $336</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">19,544<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">17,486<span></span></td> </tr> <tr class=\"ro\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Inventories</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">2,660<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">1,938<span></span></td> </tr> <tr class=\"re\" style=\"background-color: #EAEAEA\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Deferred income taxes</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">1,941<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">1,632<span></span></td> </tr> <tr class=\"ro\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Other</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">4,392<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">3,388<span></span></td> </tr> <tr class=\"reu\" style=\"background-color: #EAEAEA\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Total current assets</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em;border-bottom: 1px solid #000\">114,246<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em;border-bottom: 1px solid #000\">101,466<span></span></td> </tr> <tr class=\"ro\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Property and equipment, net of accumulated depreciation of $14,793 and $12,513</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">13,011<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">9,991<span></span></td> </tr> <tr class=\"re\" style=\"background-color: #EAEAEA\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Equity and other investments</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">14,597<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">10,844<span></span></td> </tr> <tr class=\"ro\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Goodwill</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">20,127<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">14,655<span></span></td> </tr> <tr class=\"re\" style=\"background-color: #EAEAEA\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Intangible assets, net</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">6,981<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">3,083<span></span></td> </tr> <tr class=\"ro\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Other long-term assets</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">3,422<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">2,392<span></span></td> </tr> <tr class=\"reu\" style=\"background-color: #EAEAEA\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Total assets</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em;border-bottom: 1px solid #000\">172,384<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em;border-bottom: 1px solid #000\">142,431<span></span></td> </tr> <tr class=\"ro\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\"><strong>Current liabilities:</strong></td> <td class=\"text\" style=\"text-align: left;white-space: normal\"> <span></span></td> <td class=\"text\" style=\"text-align: left;white-space: normal\"> <span></span></td> </tr> <tr class=\"re\" style=\"background-color: #EAEAEA\" <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Accounts payable</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">7,432<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">4,828<span></span></td> </tr> <tr class=\"ro\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Short-term debt</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">2,000<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">0<span></span></td> </tr> <tr class=\"re\" style=\"background-color: #EAEAEA\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Current portion of long-term debt</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">0<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">2,999<span></span></td> </tr> <tr class=\"ro\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Accrued compensation</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">4,797<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">4,117<span></span></td> </tr> <tr class=\"re\" style=\"background-color: #EAEAEA\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Income taxes</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">782<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">592<span></span></td> </tr> <tr class=\"ro\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Short-term unearned revenue</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">23,150<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">20,639<span></span></td> </tr> <tr class=\"re\" style=\"background-color: #EAEAEA\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Securities lending payable</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">558<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">645<span></span></td> </tr> <tr class=\"ro\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Other</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">6,906<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">3,597<span></span></td> </tr> <tr class=\"reu\" style=\"background-color: #EAEAEA\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Total current liabilities</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em;border-bottom: 1px solid #000\">45,625<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em;border-bottom: 1px solid #000\">37,417<span></span></td> </tr> <tr class=\"ro\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Long-term debt</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">20,645<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">12,601<span></span></td> </tr> <tr class=\"re\" style=\"background-color: #EAEAEA\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Long-term unearned revenue</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">2,008<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">1,760<span></span></td> </tr> <tr class=\"ro\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Deferred income taxes</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">2,728<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">1,709<span></span></td> </tr> <tr class=\"re\" style=\"background-color: #EAEAEA\" <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Other long-term liabilities</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">11,594<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">10,000<span></span></td> </tr> <tr class=\"rou\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Total liabilities</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em;border-bottom: 1px solid #000\">82,600<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em;border-bottom: 1px solid #000\">63,487<span></span></td> </tr> <tr class=\"re\" style=\"background-color: #EAEAEA\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Commitments and contingencies</td> <td class=\"text\" style=\"text-align: left;white-space: normal\"> <span></span></td> <td class=\"text\" style=\"text-align: left;white-space: normal\"> <span></span></td> </tr> <tr class=\"ro\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\"><strong>Stockholders' equity:</strong></td> <td class=\"text\" style=\"text-align: left;white-space: normal\"> <span></span></td> <td class=\"text\" style=\"text-align: left;white-space: normal\"> <span></span></td> </tr> <tr class=\"re\" style=\"background-color: #EAEAEA\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Common stock and paid-in capital - shares authorized 24,000; outstanding 8,239 and 8,328</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">68,366<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">67,306<span></span></td> </tr> <tr class=\"ro\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Retained earnings</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">17,710<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">9,895<span></span></td> </tr> <tr class=\"re\" style=\"background-color: #EAEAEA\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Accumulated other comprehensive income</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">3,708<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em\">1,743<span></span></td> </tr> <tr class=\"rou\" style=\"background-color: #fff\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Total stockholders' equity</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em;border-bottom: 1px solid #000\">89,784<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em;border-bottom: 1px solid #000\">78,944<span></span></td> </tr> <tr class=\"reu\" style=\"background-color: #EAEAEA\"> <td class=\"pl\" style=\"text-align: left;vertical-align: top;white-space: normal;width: 200px;word-wrap: break-word;border-bottom: 0px\" valign=\"top\">Total liabilities and stockholders' equity</td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em;border-bottom: 1px solid #000\">$ 172,384<span></span></td> <td class=\"nump\" style=\"text-align: right;white-space: nowrap;padding: 0 .4em 0 2em;border-bottom: 1px solid #000\">$ 142,431<span></span></td> </tr> </tbody></table></body></html>"
}
404 Not Found
Company does not have a financial statement of this type
Code samples
@ECHO OFF
curl -v -X GET "https://services.last10k.com/v1/company/{ticker}/balancesheet?formType=10-K&filingOrder=0"
-H "Ocp-Apim-Subscription-Key: {subscription key}"
--data-ascii "{body}"
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;
namespace CSHttpClientSample
{
static class Program
{
static void Main()
{
MakeRequest();
Console.WriteLine("Hit ENTER to exit...");
Console.ReadLine();
}
static async void MakeRequest()
{
var client = new HttpClient();
var queryString = HttpUtility.ParseQueryString(string.Empty);
// Request headers
client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "{subscription key}");
// Request parameters
queryString["formType"] = "10-K";
queryString["filingOrder"] = "0";
var uri = "https://services.last10k.com/v1/company/{ticker}/balancesheet?" + queryString;
var response = await client.GetAsync(uri);
}
}
}
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
public class JavaSample
{
public static void main(String[] args)
{
HttpClient httpclient = HttpClients.createDefault();
try
{
URIBuilder builder = new URIBuilder("https://services.last10k.com/v1/company/{ticker}/balancesheet");
builder.setParameter("formType", "10-K");
builder.setParameter("filingOrder", "0");
URI uri = builder.build();
HttpGet request = new HttpGet(uri);
request.setHeader("Ocp-Apim-Subscription-Key", "{subscription key}");
// Request body
StringEntity reqEntity = new StringEntity("{body}");
request.setEntity(reqEntity);
HttpResponse response = httpclient.execute(request);
HttpEntity entity = response.getEntity();
if (entity != null)
{
System.out.println(EntityUtils.toString(entity));
}
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}
}
<!DOCTYPE html>
<html>
<head>
<title>JSSample</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(function() {
var params = {
// Request parameters
"formType": "10-K",
"filingOrder": "0",
};
$.ajax({
url: "https://services.last10k.com/v1/company/{ticker}/balancesheet?" + $.param(params),
beforeSend: function(xhrObj){
// Request headers
xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","{subscription key}");
},
type: "GET",
// Request body
data: "{body}",
})
.done(function(data) {
alert("success");
})
.fail(function() {
alert("error");
});
});
</script>
</body>
</html>
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString* path = @"https://services.last10k.com/v1/company/{ticker}/balancesheet";
NSArray* array = @[
// Request parameters
@"entities=true",
@"formType=10-K",
@"filingOrder=0",
];
NSString* string = [array componentsJoinedByString:@"&"];
path = [path stringByAppendingFormat:@"?%@", string];
NSLog(@"%@", path);
NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
[_request setHTTPMethod:@"GET"];
// Request headers
[_request setValue:@"{subscription key}" forHTTPHeaderField:@"Ocp-Apim-Subscription-Key"];
// Request body
[_request setHTTPBody:[@"{body}" dataUsingEncoding:NSUTF8StringEncoding]];
NSURLResponse *response = nil;
NSError *error = nil;
NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];
if (nil != error)
{
NSLog(@"Error: %@", error);
}
else
{
NSError* error = nil;
NSMutableDictionary* json = nil;
NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
NSLog(@"%@", dataString);
if (nil != _connectionData)
{
json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
}
if (error || !json)
{
NSLog(@"Could not parse loaded json with error:%@", error);
}
NSLog(@"%@", json);
_connectionData = nil;
}
[pool drain];
return 0;
}
<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';
$request = new Http_Request2('https://services.last10k.com/v1/company/{ticker}/balancesheet');
$url = $request->getUrl();
$headers = array(
// Request headers
'Ocp-Apim-Subscription-Key' => '{subscription key}',
);
$request->setHeader($headers);
$parameters = array(
// Request parameters
'formType' => '10-K',
'filingOrder' => '0',
);
$url->setQueryVariables($parameters);
$request->setMethod(HTTP_Request2::METHOD_GET);
// Request body
$request->setBody("{body}");
try
{
$response = $request->send();
echo $response->getBody();
}
catch (HttpException $ex)
{
echo $ex;
}
?>
########### Python 2.7 #############
import httplib, urllib, base64
headers = {
# Request headers
'Ocp-Apim-Subscription-Key': '{subscription key}',
}
params = urllib.urlencode({
# Request parameters
'formType': '10-K',
'filingOrder': '0',
})
try:
conn = httplib.HTTPSConnection('services.last10k.com')
conn.request("GET", "/v1/company/{ticker}/balancesheet?%s" % params, "{body}", headers)
response = conn.getresponse()
data = response.read()
print(data)
conn.close()
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))
####################################
########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64
headers = {
# Request headers
'Ocp-Apim-Subscription-Key': '{subscription key}',
}
params = urllib.parse.urlencode({
# Request parameters
'formType': '10-K',
'filingOrder': '0',
})
try:
conn = http.client.HTTPSConnection('services.last10k.com')
conn.request("GET", "/v1/company/{ticker}/balancesheet?%s" % params, "{body}", headers)
response = conn.getresponse()
data = response.read()
print(data)
conn.close()
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))
####################################
require 'net/http'
uri = URI('https://services.last10k.com/v1/company/{ticker}/balancesheet')
query = URI.encode_www_form({
# Request parameters
'formType' => '10-K',
'filingOrder' => '0'
})
if uri.query && uri.query.length > 0
uri.query += '&' + query
else
uri.query = query
end
request = Net::HTTP::Get.new(uri.request_uri)
# Request headers
request['Ocp-Apim-Subscription-Key'] = '{subscription key}'
# Request body
request.body = "{body}"
response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
http.request(request)
end
puts response.body