Purpose of this REST API endpoint

    The data reported by your site's Metered License Agent is available to you should you wish to download this data in order to generate your own charts or reports in-house.  

    Basic Usage

    1. Do an initial retrieval of all data for a single supervisor, from the very first record ever reported to the most current record available.
    2. Make a note of the 'id' from the last record in that dataset; you will use that value + 1 as the "starting id" the next time you ask for more records.
    3. At least 15 minutes after you perform the initial retrieval of all records, do another retrieval with the "starting id" set to the starting id from the last step.

    Python Dependencies

    You can write your script in any language you like, but my example is in Python.  Should you choose to also use Python, you'll need the Python Requests module and a very current version of Python 2.7 to satisfy the TLS/SSL requirements.  I work with Python 2.7.13, but you can use most versions of Python that ship with CentOS 7 or other modern linux distribution.  I suggest using Pip to install Requests.

    Authentication and Authorization

    You must supply credentials for a user account authorized to access the data for a given supervisor; these are the user name and password used to login to the Metered Portal, and can be the same credentials that your Metered Licence Agent uses to connect to https://mls.pipelinefx.com.

    Usage Record Retrieval

    Sample MySQL table for record storage

    I recommend storing all the retrieved records in a MySQL database for ease of charting, reporting, determining the starting id of the next data retrieval, etc.  The following should serve as a starting place for your table.

    Note: this table will not be normalized (does not adhere to one or more normal forms) but creating a macaddress table and using the id from the macaddress table in this table to do INNER JOIN's is beyond the scope of the page.  Also note that the id column is not an auto-increment, but please be aware that it will still be unique, as that id value comes from another table in in which it is an auto-increment value.



    • No labels