Interviews / Opinions

TalentLMS’ API Automation Made Easy!

TalentLMS' API Automation Made Easy - TalentLMS Blog

In our inter-connected world, when you design your eLearning portal, you want it to be able to speak directly to your existing platforms, be that your CRM system, your CMS, your blog, your eCommerce platform, you name it.

Yes, TalentLMS natively supports SSO through LDAP and SAML2, allowing you to seamlessly log in across all platforms that support SSO. It also allows your users to register and login to your eLearning portal with their favorite social media accounts, such as Google, LinkedIn, and Facebook. It has integrations with and plugins for dozens of systems such as Shopify, WordPress, GoToMeeting, BigBlueButton, Zoom.us, Paypal, Stripe and so on. And it connects to thousands of other applications through Zapier.

But, at some point, you might want it to speak to an external system that is not already supported. Or you might simply want to automate a tedious administrative task. (Yes, we all hate those!).

For all that, TalentLMS offers a REST API, and a PHP wrapper library on top of it.

As you may have realized, this article is pretty technical, because, well, I’m a technical kind of guy. But bear with me, there is a great and quite simplified solution later on in the post. Now, back to the story…

REST (REpresentational State Transfer) is an architectural style, that relies on web technologies such as the HTTP protocol, JSON (JavaScript Object Notation) and allows parties to exchange information.

As already mentioned, TalentLMS already provides a PHP wrapper library that you can use to consume our API on a PHP project (we develop TalentLMS using PHP after all). But we get a lot of questions from people that don’t use PHP. Can I use your Rest API with C#? Can I use your Rest API with Java? With a UNIX shell script?

The answer to all is: of course you can! It is a Rest API. The language and platform that you use won’t matter! You only need to be able to make HTTP calls on API endpoints and read the responses (written in JSON format).

The Collection

To demonstrate this as clearly as possible but also to make it easier for you to test the API, we have created an API collection in POSTMAN (a chrome plugin for making Rest API calls from within your browser – now also available as a standalone application).

The collection contains an example for almost every API call that is supported in TalentLMS. And it is organized in categories such as Users / Courses / Groups / Branches / System. We will keep updating the collection with new API calls once those are available.

From there you can test the various TalentLMS’ API endpoints or even use it as an external admin tool!

What You Can Do With It

  • You can retrieve a list of all users in TalentLMS.
  • You can see what courses one learner is enrolled in and which ones of those are completed.
  • You can find the answers that a learner has given to a test or survey.

But you can also perform actions such as creating a new user, enrolling a learner in a course, activating/deactivating a user, and so on.

Generating Code

One of the handy features is that you can automatically generate code snippets to use in your preferred programming language!

TalentLMS API - Postman Library

You can first customize the API call to your needs and then generate the code snippet.

The supported languages currently include C, CURL, C#, Go, java, Objective-C, Python, PHP, ruby, Shell, Swift, and many more.

Conclusion

You have learned how to easily test TalentLMS’ API using our ready-made POSTMAN collection and generate code snippets in different programming languages.

But just because the API is now so easy to use, you shouldn’t forget that it still is a very powerful tool. And as a systems administrators would tell you, with great powers comes great responsibility. Don’t say we didn’t warn you. 🙂

 

About the author: Yiannis is a senior developer in TalentLMS. He has a passion for the Internet and open source technologies and has been involved in the development of web applications for over a decade. He holds an MSc in Computing and Internet Systems from King’s College University of London, UK.