API

Solodev empowers users to extend their data and content using a built-in Application Programming Interface (API) that allows you to expose data stored in modules to external publishing channels such as websites, mobile apps, intranets, and other API enabled technologies. This article will teach you how to access data stored in your Solodev modules using Solodev's built-in API.

For more information on Solodev Modules, please click here.


Use Case

Let's say you want the same content from the news module on your website to be displayed on your mobile app in realtime. This is a common scenario in which Solodev's built-in API can make life significantly easier for your development team.

Step 1 - Navigate to the module you'd like to expose and click "Modify"

Screen_Shot_2017-05-18_at_12.06.11_PM.png


Step 2 - Scroll down to the "API INFO" Panel and expand it

Screen_Shot_2017-05-18_at_12.07.44_PM.png


Step 3 - Copy and Paste the API URL into your browser

Screen_Shot_2017-05-18_at_12.09.09_PM.png


Step 4 - Navigate to the users directory and open up your user folder

Scroll down to the "API Information" tab and click "Generate Key."

Screen_Shot_2017-05-18_at_12.29.16_PM.png


Step 5 - Navigate to browser where API URL was pasted

Screen_Shot_2017-05-18_at_12.30.41_PM.png


Step 6 - Copy and Paste Token and Token Secret Fields 

Copy the API Token and API Token Secret from your profile and replace the default values in your web browser. Before hitting enter, make sure your website URL is appended to the URL. The end result should look something like this:

www.webcorpco.com/api/index.php/search/solodev_view?qry={"calendar_id":77}&token=687d3883ddacbcf204b4d37cd75a65f0ab8704f8&token_secret=5b7190c34792bc0d8ed75c1cdbbb24fcb5dab5a1


Step 7 - Make the Call (Hit Enter)

All of the data from your module will be returned in JSON format. Now that you know how to access your Solodev Modules via API you can make custom API calls to integrate and style certain fields for the purposes of your mobile app.

Screen_Shot_2017-05-18_at_12.39.14_PM.png


Step 8 - Make an API call on one entry from your module

Typically, you'll only want to retrieve a single news entry. Let's take a look at how you can modify the API call above to only retrieve a specific entry. In this case, I only want Solodev's API to return the news entry titled "Selecting a Website Content Management System?" So how would I go about doing this?

When opening the entry I can see it's ID is 294. Looking at the JSON returned in the previous screenshot, I see the field for an entry is called "calendar_entry_id".

Screen_Shot_2017-05-18_at_12.52.40_PM.png

I modify my query as shown below.

http://webcorpco.com/api/index.php/search/solodev_view?qry={"calendar_id":77,"calendar_entry_id":294}&token=687d3883ddacbcf204b4d37cd75a65f0ab8704f8&token_secret=5b7190c34792bc0d8ed75c1cdbbb24fcb5dab5a1

Note: See how all I did was add a parameter to my query. I added the field calendar_entry_id and specified the ID of the entry I wanted Solodev to return. The results of my call are below.

Screen_Shot_2017-05-18_at_12.57.58_PM.png

Note: You can add as many parameters as Solodev allows which in this case is a lot. For example, you can add parameters to your query to return entries within a certain category group or time table. Solodev allows you to get extremely granular, allowing you to make an API call that returns only 1 field from 1 entry from 1 module. Enjoy!

 

0 Comments

Please sign in to leave a comment.
Have more questions? Submit a request