MuniAlerts API
Introduction
US Municipal Bond Market
Key Features
- Files usually available by 7:00am EST
- Files available for 30 days
- Simple HTTP interface to retrieve files
- Download files programmatically or with a web browser
Key Data Points
API URL
https://api.munialerts.info/api
Authentication
In order to authenticate with the API, you must provide your API key (Please refer to API Key) as the _api_key URL query string parameter during every HTTP request.
Request the Token
The token can be requested from the FactEntry Support Team (support@factentry.com) and should be replaced with XXXXX in the API key.
Request Format
The request is passed in via HTTP request body. The only supported HTTP verb is POST/GET.
Example Query String
https://api.munialerts.info/api?token=XXXXXXXXXXXXX&entity_name=State of Wisconsin&announcement_date=2016-04-04&ISIN=US977100AX41&ca_type=Amortizing&country=United States
Input Parameters
Response Format (JSON)
{
"code": 200,
"count": 1,
"data": [
{
"ISIN": "US977100AX41",
"Region": "N.Amer",
"Sector": "Sub Sovereign",
"Seniority": ""
}
],
"message": "Data found",
"status": "ok"
}
Output
Status Code
Python
import requests
response_json = requests.get('https://api.munialerts.info/api?token=XXXXXXXXXXXXXXX&ISIN=IT0006703208')
print(response_json)
PHP
$url = "https://api.munialerts.info/api";
$post = "token=XXXXXXXXXXXXX&ISIN=US977100AX41";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,false);
$content=curl_exec($curl);
curl_close($curl);
//print JSON data
echo $content;
JAVA
package javaapplication1;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.logging.Level;
import java.util.logging.Logger;
public class JavaApplication1 {
public static void main(String[] args) {
HttpURLConnection connection = null;
String urlParameters = null;
try {
urlParameters = "token=" + URLEncoder.encode("xxxxxxxxTOKENxxxxxxxxxxxx", "UTF-8")+
"&ISIN=" + URLEncoder.encode("US977100AX41", "UTF-8");
} catch (UnsupportedEncodingException ex) {
Logger.getLogger(JavaApplication1.class.getName()).log(Level.SEVERE, null, ex);
}
try {
//Create connection
URL url = new URL("https://api.munialerts.info/api");
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
//connection.setRequestProperty("Content-Length", Integer.toString(urlParameters.getBytes().length));
connection.setRequestProperty("Content-Language", "en-US");
connection.setUseCaches(false);
connection.setDoOutput(true);
//Send request
DataOutputStream wr = new DataOutputStream (
connection.getOutputStream());
wr.writeBytes(urlParameters);
wr.close();
//Get Response
InputStream is = connection.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
StringBuilder response = new StringBuilder(); // or StringBuffer if Java version 5+
String line;
while ((line = rd.readLine()) != null) {
response.append(line);
response.append('\r');
}
rd.close();
System.out.println(response.toString());
}
catch (Exception e) {
}
finally {
if (connection != null) {
connection.disconnect();
}
}
}
}