API

A core concept of this index site is that its content be available to plugin authors (e.g. to implement updating or referencing capabilities) and other websites (e.g. to implement search tools) through both RSS feeds and an API. The following sections explain what is currently available.

RSS Feeds

Currently, these RSS feeds are provided:

Recent Plugins: http://sketchupplugins.com/plugins/rss/
Recent Posts: http://sketchupplugins.com/feed/rss/
Recent Comments: http://sketchupplugins.com/comments/feed/rss/
Recent Forum Topics: http://sketchupplugins.com/forums/rss/

API:

You can use the following URLs to retrieve this website’s data programmatically. If a plugin ID is required, use the number provided on a plugin’s page (shown in the information box).

Single plugin lookup

Use the following URL to retrieve all meta-data associated with a single plugin:

http://sketchupplugins.com/get/single.php?id=<enter numeric id here>&callback=

The example below shows a sample JSONP-formatted response:

({
    "version": [
        "1.0"
    ],
    "release_date": [
        "10\/11\/2008"
    ],
    "availability": [
        "Free"
    ],
    "compatibility": [
        "Win & Mac"
    ],
    "sketchup_versions": [
        "a:4:{i:0;s:6:\"v.8 M2\";i:1;s:6:\"v.8 M1\";i:2;s:3:\"v.8\";i:3;s:3:\"v.7\";}"
    ],
    "plugin_installer_url": [
        "http:\/\/www.alexschreyer.net\/downloads\/GetCentroid.rbz"
    ],
    "publisher_url": [
        "http:\/\/www.alexschreyer.net\/projects\/centroid-and-area-properties-plugin-for-sketchup\/"
    ],
    "plugin_author": [
        "Alex Schreyer"
    ],
    "changelog": [
        "1.0 (10\/11\/2008) \u2013 First version"
    ],
    "donation_url": [
        ""
    ],
    "title": [
        "Centroid and Area Properties"
    ],
    "plugin_name": [
        "Face Centroid"
    ]
    "plugin_url": [
        "http:\/\/sketchupplugins.com\/plugins\/centroid-and-area-properties-plugin\/"
    ]
});

Note that individual variables are always wrapped in an array. You will have to access e.g. the version as jsondata.version[0] in Javascript.

Below is a Ruby example that shows how you could use this function from within SketchUp. This approach makes it very easy to alert your users when a new version is available, for example.

# The code below checks a stored version number
# against a number stored on www.sketchupplugins.com
# and suggests an update if necessary

# version of installed plugin
version = 0.9

dlg_html="<html>
<head><title></title>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script>
</head>
<body>
<p><b>Plugin:</b> <span id='ptitle'>Loading...</span><br />
<b>Installed Version:</b> #{version}<br />
<b>Current Version:</b> <span id='pversion'></span><br />
<b><a id='plink' href='#' target='_blank'><span id='update'>Download</span></a></b></p>
<script>
// # Use correct plugin ID below
var plugin_id = '281';
var ver = #{version};
$.getJSON('http://sketchupplugins.com/get/single.php?callback=?',
{ id : plugin_id},
function(data) {
$('#ptitle').html(data.title[0]);
$('#pversion').html(data.version[0]);
$('#plink').attr('href',data.plugin_url[0]);
if (data.version[0] > ver) {
$('#update').text('Download update now');
} else {
$('#update').text('You have the latest version');
};
});
</script>
</body>
</html>"
dlg = UI::WebDialog.new('Checking for update...', true,'UpdateDialog', 400, 200, 150, 150, true)
dlg.navigation_buttons_enabled = false
dlg.set_html(dlg_html)
dlg.show

Plugin version lookup

Use the following URL to retrieve a single plugin’s currently stored version number as an unformatted response. You could use this to display the number in an iframe, for example.

http://sketchupplugins.com/get/version.php?id=<enter numeric id here>

Plugin search

Not available yet.

API Terms of Use:

You may use the above feeds and APIs for free in your applications, plugins and websites provided that:

  • You add a note below the supplied material (or on an About/Help page) that says “Plugin indexing data provided through sketchupplugins.com” (small font is okay but the link must be included).
  • The application does not cause a too heavy load on my server. I’ll let you know if it does and we will have to work out a solution.

Ideas or comments? Add them below:

  • http://alexschreyer.net Alexander Schreyer

    UPDATE: Just updated the sample code to actually do update checking. You can now just paste it into your plugin and use it.