CradlePoint API info

June 30, 2015 at 8:29 pm 10 comments

Every CradlePoint router (with at least a reasonably recent firmware) includes a very nice API.

However, if you search looking for documentation on their website about it, you’ll only find information on the API for ECM, their central management service.

Here are a few very useful URLs that you can call with the Restful client of your choice:

Figure out what model of CradlePoint you’ve reached, and/or the serial number:
https://  [CradlePoint IP]/api/status/product_info/

{
“data”: {
“company_name”: “Cradlepoint, Inc.”,
“copyright”: “Cradlepoint, Inc. 2015”,
“mac0”: “REDACTED“,
“company_url”: “http://cradlepoint.com”,
“manufacturing”: {
“board_ID”: “050000”,
“mftr_date”: “20150401”,
“serial_num”: “REDACTED
},
“product_name”: “CBA850”
},
“success”: true
}

Get your firmware version (major.minor.patch):
https:// [CradlePoint IP]/api/status/fw_info
{
“data”: {
“build_date”: “Thu Feb 19 12: 00: 07 MST 2015”,
“manufacturing_upgrade”: false,
“major_version”: 5,
“custom_defaults”: false,
“minor_version”: 3,
“fw_update_available”: false,
“patch_version”: 4,
“upgrade_minor_version”: 0,
“build_version”: 13953,
“upgrade_major_version”: 0,
“upgrade_patch_version”: 0,
“build_type”: “RELEASE”
},
“success”: true
}

Find out if you’re connected:

https:// [CradlePoint IP]/api/status/wan/connection_state

{
“data”: “connected”,
“success”: true
}

Get your WAN interface IP:
https:// [CradlePoint IP]/api/status/wan/ipinfo
{
“data”: {
“netmask”: “255.255.255.248”,
“dns”: [
“10.10.10.10”,
“10.10.11.11”
],
“ip_address”: “172.16.24.27”,
“primary”: “lte-REDACTED“,
“gateway”: “172.16.24.25”
},
“success”: true
}

Too much good diag stuff to mention: 

Please note, I REDACTED most of the unique identifying info, but these fields are all available on your gear.  To get the portion of the URL that’s redacted, look in the “primary” key of the result of your WAN ip info, shown just above.

https:// [CradlePoint IP]/api/status/wan/devices/lte-REDACTED/diagnostics

{
“data”: {
“HM_PLMN”: “310410”,
“CELL_ID”: “176898562 (0xa8b4202)”,
“CARRID”: “AT&T”,
“CS”: “UP”,
“PIN_STATUS”: “READY”,
“GSN”: “REDACTED“,
“PRD”: “MC400LPE (SIM1)”,
“VER_PKG”: “05.05.16.02_ATT,005.010_002”,
“MDN”: “REDACTED“,
“MDL”: “MC400LPE (SIM1)”,
“TXCHANNEL”: “20576”,
“HOMECARRID”: “AT&T”,
“MODEMOPMODE”: “Online”,
“ROAM”: “1”,
“FW_CARRIER_LOAD”: “ATT”,
“VER”: “SWI9X15C_05.05.16.02 r21040 carmd-fwbuild1 2014/03/17 23:49:48”,
“CFGAPNMASK”: “65534”,
“MODEMPSSTATE”: “Attached”,
“RXCHANNEL”: “2576”,
“LTEBANDWIDTH”: “5 MHz”,
“VER_PREF_PKG”: “05.05.16.02_ATT,005.010_002”,
“RSRQ”: “-7”,
“RSRP”: “-90”,
“DBM”: “-69”,
“SCRAPN”: “16”,
“MDM_MODE_CAPABILITIES”: “55”,
“SS”: “100”,
“LAST_PIN”: “”,
“ICCID”: “REDACTED“,
“BANDULFRQ”: “824-849”,
“TX_LTE”: “-6.5”,
“RFBAND”: “Band 5”,
“SELAPN”: “1”,
“DISP_MEID”: “REDACTED“,
“SINR”: “21.2”,
“EMMSTATE”: “Registered”,
“VER_PRETTY”: “5.5.16.2”,
“CHIPSET”: “9X15C”,
“MODEMTEMP”: “40”,
“HW_VER”: “1.0”,
“PIN_RETRIES”: “3”,
“IS_LTE”: “true”,
“CGSN”: “REDACTED“,
“MFG_MDL”: “MC7354-CP”,
“MDM_CONTROL_TYPE”: “NORMAL”,
“MFG”: “CradlePoint Inc.”,
“PRLV”: “1”,
“LAST_PIN_VALID”: “False”,
“DISP_IMEI”: “REDACTED“,
“PRI_VER”: “05.03”,
“DEFAPN”: “1”,
“DORMANT”: “Dormant”,
“PUK_RETRIES”: “10”,
“DEFAPNTYPE”: “IP”,
“EMMSUBSTATE”: “Normal Service”,
“SIM_LOCK”: “FALSE”,
“SERDIS”: “LTE”,
“MODEMIMSSTATE”: “No service”,
“CUR_PLMN”: “310410”,
“BANDDLFRQ”: “869-894”,
“RFCHANNEL”: “2576”,
“MODEMSYSMODE”: “LTE”,
“IMSI”: “REDACTED“,
“EMMCOMMSTATE”: “RRC Idle”,
“MDM_DRIVER_CAPABILITIES”: “244785”,
“PRI_ID”: “9903437”
},
“success”: true
}

My favorite (so far) is a bit difficult to explain in this blog post, but I’ll try:

https:// [CradlePoint IP]/api/control/netperf

To use this, you need 5.4.0 or newer firmware, and you’ll really need your own NetPerf server, but if you get that set up, you should be able to initiate your own speed tests across the LTE link.  You’ll need to pass data to this one, though, so it’s a bit harder.  Here’s my data template, with words surrounded by percent signs as variables.

$json_template = ‘{“input”:{“options”:{“limit”:{“size”:%size%,”time”:%timeout%},”port”:””,”host”:”%host%”,”ifc_wan”:””,”recv”:%recv%,”send”:%send%,”tcp”:true,”udp”:false},”tests”:null},”run”:1}’;

After customizing this for the test that I want to perform, I do a HTTP PUT of this data.  In my case, with PHP, I have to pass my $json like this:  array(‘data’ => $json).

Anyhow, doing this kicks off a speedtest that runs for %timeout% seconds.  You can then to a GET to the /api/control/netperf URL and get a status, like so:

https:// [CradlePoint IP]/api/control/netperf

{
“data”: {
“input”: {
“tests”: null,
“options”: {
“udp”: false,
“limit”: {
“size”: 0,
“time”: 10
},
“tcp”: true,
“recv”: true,
“port”: null,
“send”: false
}
},
“output”: {
“results_path”: null,
“status”: “idle”,
“command”: null,
“error”: null,
“progress”: 0,
“guid”: -1
}
},
“success”: true
}

In the “output” section above, had I just performed a test, I could look at the value of “results_path”, which is a URL to the results of the test.

There is a TON of great info you can get from the CradlePoint API.  CradlePoint built their web interface off of the API, so pretty much anything you see in the web interface can be accessed via the API.  In fact, if you simply use a tool like HTTPwatch to look at the interaction between your web browser and the remote CradlePoint device, you’ll be able to learn how to do all this yourself.

 

Advertisements

Entry filed under: CradlePoint, Networking, PHP, Programming General. Tags: .

Graduation Savings Accounts Can’t trust Cell coverage maps? Make your own!

10 Comments Add your own

  • 1. ydemissie  |  September 18, 2015 at 8:38 pm

    Great stuff!! So do you run your php script on your netperf server? Is your script kicking off a netperf client on the Cradlepoint (assuming it has the netperf client)? What does the host in your template point to the netperf client or the netperf server (netserver)? Trying to wrap my head around the logic so I can build one for my mbr1400v2. I already have netperf server on a linux box. Thanks!

    Reply
    • 2. ptaylor  |  September 18, 2015 at 8:49 pm

      The PHP script actually runs on our network management server. We have netperf running on a VM specifically for that purpose. The template tells the CradlePoint to connect to our netperf server and perform a test. We send that template to the CradlePoint API on our remote units. The template essentially passes the same parameters that are in the GUI.

      Reply
  • 3. ydemissie  |  September 18, 2015 at 10:23 pm

    Got it. I should be to create mine now. Thanks!

    Reply
  • 4. ydemissie  |  September 21, 2015 at 2:44 pm

    I’m trying to get the data from the api links such as /api/status/wan/connection_state but I keep getting “string(61) “{ “success”: false, “reason”: “authentication failure” }”. I’m using php and curl to authenticate (with CURLOPT_HTTPAUTH, CURLAUTH_ANY) using my admin username and password. Did you ever run into this authentication issue at all?

    I’ve emailed my Cradlepoint rep to see if I can get their API doc the router.

    Thanks!

    Reply
    • 5. ptaylor  |  September 21, 2015 at 5:28 pm

      I’m using something like:
      $credentials = “username:password”;
      curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
      curl_setopt($curl, CURLOPT_USERPWD, $credentials);

      Reply
  • 6. ydemissie  |  September 21, 2015 at 5:45 pm

    Yeah, I had tried both basic and digest unsuccessfully. I’ll be getting the API doc from Cradlepoint in the next couple of days. I’ll troubleshooting it then and I’ll let you know if I learn anything useful. Thanks for getting back to me!

    Reply
    • 7. ptaylor  |  September 21, 2015 at 6:05 pm

      Look at this blog post, it may help: http://wp.me/p4ANz-ld

      Reply
    • 8. ptaylor  |  September 21, 2015 at 6:07 pm

      If they give you any API docs for the actual cradle point routers, I’d love to see them (if they don’t NDA you). All I’ve been able to find is API documentation for their ECM product. And when I asked our rep, he pretty much ignored my request.

      Reply
    • 9. ptaylor  |  September 21, 2015 at 6:12 pm

      Your problem may be CURLOPT_SSL_VERIFYPEER or CURLOPT_SSL_VERIFYHOST, if you are using HTTPS. Those are two items I had to set in my modified version of the Restful class I’m using (in my newest blog post).

      Reply
    • 10. ptaylor  |  September 21, 2015 at 6:23 pm

      Oh, one more thing. You may notice that my examples include a username and a password, so I have the advanced authentication turned on. Also, if you are using radius authentication for the web interface, note that you need to use local authentication for the API. I think trying to authenticate to the API with a radius user will fail.

      Reply

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

June 2015
S M T W T F S
« Apr   Jul »
 123456
78910111213
14151617181920
21222324252627
282930  

Most Recent Posts


%d bloggers like this: