MSLAPI Demo

On this page we will show the MSL API application that can connect our databases to any machine via the internet. API stands for Application Programming Interface. Simply put, an API is an interface that presents any data source to the outside world. At this time, we have a select list of obejcts from our ASPeN database.

  1. Person
  2. Federations
  3. Events
  4. Organizations
  5. Services
  6. Counties
  7. EventCECredits
  8. CECategories
  9. Xref_Events_Events
  10. Xref_Events_Committees
  11. Xref_Events_Committees
  12. Xref_Events_Services
  13. Xref_Events_Services
  14. Xref_Events_Committees
  15. Xref_Events_Services
  16. EventTypes
  17. vSearch_Events_FullText

As new objects are needed, they can be easily added to the API, and one or more of the four CRUD (Create, Read, Update and Delete) functions can be added. Please note, not all four have to be added. If you only want users to have read options, then we will only set up the read function.

We can also point to more than one database, so the MSLAPI can be used for multiple programs. Each endpoint will have a layout: https://mslapi.mt.gov/api/{object name}/{id}. So, if I want to get a certain person from the persons obejct in the ASPen database whose ID number is 1234, it would look like this: https://mslapi.mt.gov/api/persons/1234. You could also leave off the ID and return a list of ALL persons.

To access this API now via postman follow these steps.

  1. First you need to get a token. Send a post request to: https://mslapi.mt.gov:7103/api/auth/login
  2. In the body of the request, include a JSON object that resembles the following:

    { "UserName":"username", "Password": "password" }

  3. In the body of the return you get a token that resembles this: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjY3NjIxOTQsImlzcyI6Imh0dHBzOi8vbG9jYWxob3N0OjcwMjAiLCJhdWQiOISuiohWYhWvL2xvY2FsaG9zdDo1MTI0In0.T4_M2z6AVGfASLEGtPpH1eRNFRBsC-XQF-YRvVvGOJA

    Please note this is an example and not a valid web token.

  4. Once you have the web token, you can then do a GET request to the API at the following address: https://mslapi.mt.gov:7103/api/API OBJECT YOU WISH TO VIEW

    So a good test object to use is Federations, so the GET call would be made to: https://mslapi.mt.gov:7103/api/Federations

  5. In Postman, under the Authorization TAB choose Bearer Token from the Auth Type list and paste the token into the token text box
  6. Once this is done, you can send your request, and in the request return body will be a JSON object containing the data you requested.
  7. To only get a single item from the API onject, add the ID after the object name, so for a Federation with the ID of 1 the GET request would go to : https://mslapi.mt.gov:7103/api/Federations/1