SlideShare a Scribd company logo
1 of 13
Update Center Developer’s Guide
Overview
This document is intended to provide information about the various web requests
that can be performed on the Snap Creator Update Center. Each entry details the
format, parameters, and return values. Return values can be formatted in JSON,
XML, or HTML.
Sample codefrom Plugin Controller:
def show
@plugin = Plugin.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render xml: @plugin }
format.json { render json: @plugin }
end
end
Depending on which format the get request is sent, the Update Center will respond
with the same format. Plugins, Agents, and Servers are able to be created, updated,
shown, and deleted through web APIs using json or xml.
rest-client gem
Examples on how to use Rest Client:
These examples and more information are located at https://github.com/rest-
client/rest-client.
RestClient.get 'http://example.com/resource'
RestClient.get 'http://example.com/resource', {:params => {:id => 50, 'foo' =>
'bar'}}
RestClient.get 'https://user:password@example.com/private/resource', {:accept =>
:json}
RestClient.post 'http://example.com/resource', :param1 => 'one', :nested => {
:param2 => 'two' }
RestClient.post "http://example.com/resource", { 'x' => 1 }.to_json, :content_type
=> :json, :accept => :json
RestClient.delete 'http://example.com/resource'
response= RestClient.get 'http://example.com/resource'
response.code
➔200
response.cookies
➔{"Foo"=>"BAR", "QUUX"=>"QUUUUX"}
response.headers
➔{:content_type=>"text/html; charset=utf-8", :cache_control=>"private" ...
response.to_str
➔n<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"n
"http://www.w3.org/TR/html4/strict.dtd">nn<html ....
RestClient.post( url,
{
:transfer => {
:path => '/foo/bar',
:owner => 'that_guy',
:group => 'those_guys'
},
:upload => {
:file => File.new(path, 'rb')
}
})
Demo Server
As an example, we create a demo server that can be run by using rails server just like the
normal Update Center. It should be run on a separate port and assumes that update center is
running on localhost:3000
Update Center Web API Documentation
Overview
The formatting for these web requests will consist of basic text appended to the Update
Center url plus additional parameters. For example:
<update_center_url>/plugins/getlatestversion?name=CoolPlugin
Plugins
GET /plugins/getlatestversion
Parameters: name - an identifier name for the plugin to get the latest version of
Description: Returns the latest version of a type of plugin based on a given
name.
Return: name (string) - the identifying name
major (int) - major version number
minor (int)- minor version number
revision (int)- revision version number
build (int)- build version number
OS (int)- compatible operating system
GET /plugins/getplugins
Parameters: Id?Id - identifies the ID for the plugins to check compatibility with
Description: Returns true or false
Return: compatible (boolean)- true if plugins are compatible, otherwise false
GET /plugins/[id](.format)
Description: Returns the object information
Return: name (string) - the identifying name
major (int) - major version number
minor (int)- minor version number
revision (int)- revision version number
build (int)- build version number
created_at (string)- Timestamp of creation
updated_at (string)- Timestamp of last updated
OS (int)- compatible operating system
POST /plugins
Description: Returns the information of object created
Body: name, major, minor, revision, and build
Return: name (string) - the identifying name
major (int) - major version number
minor (int)- minor version number
revision (int)- revision version number
build (int)- build version number
created_at (string)- Timestamp of creation
updated_at (string)- Timestamp of last updated
OS (int)- compatible operating system
PUT /plugins/[id](.format)
Description: Returns the information of object updated
Body: name, major, minor, revision, and build
Return: name (string) - the identifying name
major (int) - major version number
minor (int)- minor version number
revision (int)- revision version number
build (int)- build version number
created_at (string)- Timestamp of creation
updated_at (string)- Timestamp of last updated
OS (int)- compatible operating system
DELETE /plugins/[id](.format)
Description: Returns the information of object deleted
Return: name (string) - the identifying name
major (int) - major version number
minor (int)- minor version number
revision (int)- revision version number
build (int)- build version number
created_at (string)- Timestamp of creation
updated_at (string)- Timestamp of last updated
OS (int)- compatible operating system
Agents
/getlatestversion
Parameters: name - an identifier name for the agent to get the latest version of
Description: Returns the latest version of a type of agent based on a given
name.
Return: name (string)- the identifying name
major (int)- major version number
minor (int)- minor version number
revision (int)- revision version number
build (int)- build version number
OS (int)- compatible operating system
/getlatestplugins
Parameters: name - an identifier name for the agent to get the latest compatible
plugins for
Description: Returns multiple lines for the latest versions of compatible plugins
for a type of agent based on a given name.
Return: name (string)- the identifying name
major (int)- major version number o
minor (int)- minor version number
revision (int)- revision version number
build (int)- build version number
OS (int)- compatible operating system
GET /agents/[id](.format)
Description: Returns the object information
Return: name (string) - the identifying name
major (int) - major version number
minor (int)- minor version number
revision (int)- revision version number
build (int)- build version number
created_at (string)- Timestamp of creation
updated_at (string)- Timestamp of last updated
OS (int)- compatible operating system
POST /agents
Description: Returns the information of object created
Body: name, major, minor, revision, and build
Return: name (string) - the identifying name
major (int) - major version number
minor (int)- minor version number
revision (int)- revision version number
build (int)- build version number
created_at (string)- Timestamp of creation
updated_at (string)- Timestamp of last updated
OS (int)- compatible operating system
PUT /agents/[id](.format)
Description: Returns the information of object updated
Body: name, major, minor, revision, and build
Return: name (string) - the identifying name
major (int) - major version number
minor (int)- minor version number
revision (int)- revision version number
build (int)- build version number
created_at (string)- Timestamp of creation
updated_at (string)- Timestamp of last updated
OS (int)- compatible operating system
DELETE /agents/[id](.format)
Description: Returns the information of object deleted
Return: name (string) - the identifying name
major (int) - major version number
minor (int)- minor version number
revision (int)- revision version number
build (int)- build version number
created_at (string)- Timestamp of creation
updated_at (string)- Timestamp of last updated
OS (int)- compatible operating system
Servers
/getlatestversion
Parameters: name - an identifier name for the server to get the latest version of
Description: Returns the latest version of a type of server based on a given
name.
Return: name (int)- the identifying name
major (int)- major version number
minor (int)- minor version number
revision (int)- revision version number
build (int)- build version number
OS (int)- compatible operating system
/getlatestagents
Parameters: name - an identifier name for the server to get the latest compatible
agents for
Description: Returns multiple lines for the latest versions of compatible agents
for a type of server based on a given name.
Return: Agent name (string)- the identifying name
Agent major (int)- major version number o
Agent minor (int)- minor version number
Agent revision (int)- revision version number
Agent build (int)- build version number
Agent OS (int)- compatible operating system
GET /servers/[id](.format)
Description: Returns the object information
Return: name (string) - the identifying name
major (int) - major version number
minor (int)- minor version number
revision (int)- revision version number
build (int)- build version number
created_at (string)- Timestamp of creation
updated_at (string)- Timestamp of last updated
OS (int)- compatible operating system
POST /servers
Description: Returns the information of object created
Body: name, major, minor, revision, and build
Return: name (string) - the identifying name
major (int) - major version number
minor (int)- minor version number
revision (int)- revision version number
build (int)- build version number
created_at (string)- Timestamp of creation
updated_at (string)- Timestamp of last updated
OS (int)- compatible operating system
PUT /servers/[id](.format)
Description: Returns the information of object updated
Body: name, major, minor, revision, and build
Return: name (string) - the identifying name
major (int) - major version number
minor (int)- minor version number
revision (int)- revision version number
build (int)- build version number
created_at (string)- Timestamp of creation
updated_at (string)- Timestamp of last updated
OS (int)- compatible operating system
DELETE /servers/[id](.format)
Description: Returns the information of object deleted
Return: name (string) - the identifying name
major (int) - major version number
minor (int)- minor version number
revision (int)- revision version number
build (int)- build version number
created_at (string)- Timestamp of creation
updated_at (string)- Timestamp of last updated
OS (int)- compatible operating system
Database Schema
Overview
The Update Center is a tool to help ensure compatibilities between various components
of the Snap Creator Framework, such as agents, plugins, and servers. This requires a
database to keep track of what versions of each component exist and what their
compatibilities are.
Users
This table keeps track of the users in the system. It uses names and emails to help
identify users and has encrypted password and remember tokens to support password-
secure sessions.
ID int
Name string
Email string
Password string (encrypted)
Remember token string (encrypted)
Timestamp datetime
Plugins/Agents/Servers
Plugins/Agents/Servers need to be conscious of their name and enough information to
know which version they are. They also need to know what operating system they are to
disambiguate between the same version for different OSes.
ID int
Name string
Major int
Minor int
Revision int
Build int
OS int
Timestamp datetime
Operating System index table
In order to support multiple operating systems dynamically, we decided to make a table
of all operating systems and use the ID associated with it to reference each operating
system in plugins, agents, and servers tables.
ID int
Name string
Architectural int
Agent-Server Compatibility
The compatibility matrices will simply show which agents are compatibility with which
servers, given as IDs into their respective tables. These tables are implemented as a
white list to show what is compatible with what. Similar tables are constructed for
Plugin-Agent and Plugin-Server.
Agent-ServerCompatibility
Agent ID int
Server ID int
Plugin-Agent Compatibility
Plugin ID int
Agent ID int
Plugin-Server Compatibility
Plugin ID int
Server ID int
Seeding Database Tables
Overview
Ruby on rails allows an admin to create static table entries that persist through
database resets. We thought it was important to have a set of foundational data
preloaded into the database tables.
Locating the Seed File
The seed file can be found in the project directory under dbseeds.rb
Editing the Seed File
Open the seed file in any text editor.
The first thing you may note is that line comments are generated by a '#'. Anything
follow the pound sign will be commented.
In order to make a new entry in a table, simply type the table name, followed by create,
and then enter a value for each column of the table.
Each column must be given a value.
Auto generated values like ID or Timestamp do not need to be given a value here.
Example
Here is an example of adding a row to the Plugins table that contains the columns:
name, major, minor, revision, build, and os
Plugin.create(name: "Cool Plugin", major: "1", minor:"2", revision: "3", build:"4", OS:"1")

More Related Content

What's hot

python-message-0.1.0
python-message-0.1.0python-message-0.1.0
python-message-0.1.0勇浩 赖
 
C language header files
C language header filesC language header files
C language header filesmarar hina
 
The Steel industry, Elixir, PostgreSQL & file_fdw
The Steel industry, Elixir, PostgreSQL & file_fdwThe Steel industry, Elixir, PostgreSQL & file_fdw
The Steel industry, Elixir, PostgreSQL & file_fdwFlorian Kraft
 
Performance Teting - VU Scripting Using Rational (http://www.geektester.blogs...
Performance Teting - VU Scripting Using Rational (http://www.geektester.blogs...Performance Teting - VU Scripting Using Rational (http://www.geektester.blogs...
Performance Teting - VU Scripting Using Rational (http://www.geektester.blogs...raj.kamal13
 
DEF CON 27 - KYLE GWINNUP - next generation process emulation with binee
DEF CON 27 - KYLE GWINNUP - next generation process emulation with bineeDEF CON 27 - KYLE GWINNUP - next generation process emulation with binee
DEF CON 27 - KYLE GWINNUP - next generation process emulation with bineeFelipe Prado
 
Apache FTP Server Integration
Apache FTP Server IntegrationApache FTP Server Integration
Apache FTP Server IntegrationWO Community
 
An a z index of windows power shell commandss
An a z index of windows power shell commandssAn a z index of windows power shell commandss
An a z index of windows power shell commandssBen Pope
 
What's new in Scala 2.13?
What's new in Scala 2.13?What's new in Scala 2.13?
What's new in Scala 2.13?Hermann Hueck
 
Python concurrency: libraries overview
Python concurrency: libraries overviewPython concurrency: libraries overview
Python concurrency: libraries overviewAndrii Mishkovskyi
 
Lec 47.48 - stream-files
Lec 47.48 - stream-filesLec 47.48 - stream-files
Lec 47.48 - stream-filesPrincess Sam
 

What's hot (19)

python-message-0.1.0
python-message-0.1.0python-message-0.1.0
python-message-0.1.0
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
 
C language header files
C language header filesC language header files
C language header files
 
C++ functions
C++ functionsC++ functions
C++ functions
 
The Steel industry, Elixir, PostgreSQL & file_fdw
The Steel industry, Elixir, PostgreSQL & file_fdwThe Steel industry, Elixir, PostgreSQL & file_fdw
The Steel industry, Elixir, PostgreSQL & file_fdw
 
Linux
LinuxLinux
Linux
 
Linux
LinuxLinux
Linux
 
Linux
LinuxLinux
Linux
 
Performance Teting - VU Scripting Using Rational (http://www.geektester.blogs...
Performance Teting - VU Scripting Using Rational (http://www.geektester.blogs...Performance Teting - VU Scripting Using Rational (http://www.geektester.blogs...
Performance Teting - VU Scripting Using Rational (http://www.geektester.blogs...
 
C++ functions
C++ functionsC++ functions
C++ functions
 
Linux com
Linux comLinux com
Linux com
 
DEF CON 27 - KYLE GWINNUP - next generation process emulation with binee
DEF CON 27 - KYLE GWINNUP - next generation process emulation with bineeDEF CON 27 - KYLE GWINNUP - next generation process emulation with binee
DEF CON 27 - KYLE GWINNUP - next generation process emulation with binee
 
Apache FTP Server Integration
Apache FTP Server IntegrationApache FTP Server Integration
Apache FTP Server Integration
 
Operating System Assignment Help
Operating System Assignment HelpOperating System Assignment Help
Operating System Assignment Help
 
An a z index of windows power shell commandss
An a z index of windows power shell commandssAn a z index of windows power shell commandss
An a z index of windows power shell commandss
 
What's new in Scala 2.13?
What's new in Scala 2.13?What's new in Scala 2.13?
What's new in Scala 2.13?
 
Python concurrency: libraries overview
Python concurrency: libraries overviewPython concurrency: libraries overview
Python concurrency: libraries overview
 
Lec 47.48 - stream-files
Lec 47.48 - stream-filesLec 47.48 - stream-files
Lec 47.48 - stream-files
 
Function
FunctionFunction
Function
 

Viewers also liked

Тренировка любителей в марафонском беге
Тренировка любителей в марафонском бегеТренировка любителей в марафонском беге
Тренировка любителей в марафонском бегеRunningExpert
 
Quality management organizations
Quality management organizationsQuality management organizations
Quality management organizationsselinasimpson0801
 
Laboratory quality management system
Laboratory quality management systemLaboratory quality management system
Laboratory quality management systemselinasimpson0801
 
電話営業強化の仕方 | 株式会社コンベックス
電話営業強化の仕方 | 株式会社コンベックス電話営業強化の仕方 | 株式会社コンベックス
電話営業強化の仕方 | 株式会社コンベックスcomvexkawasaki
 
Эволюция тренерской мысли в марафонском беге
Эволюция тренерской мысли в марафонском бегеЭволюция тренерской мысли в марафонском беге
Эволюция тренерской мысли в марафонском бегеRunningExpert
 

Viewers also liked (14)

Quality management methods
Quality management methodsQuality management methods
Quality management methods
 
fall2013-team14-Interim-second_report
fall2013-team14-Interim-second_reportfall2013-team14-Interim-second_report
fall2013-team14-Interim-second_report
 
Тренировка любителей в марафонском беге
Тренировка любителей в марафонском бегеТренировка любителей в марафонском беге
Тренировка любителей в марафонском беге
 
Women's marathon
Women's marathonWomen's marathon
Women's marathon
 
Quality management organizations
Quality management organizationsQuality management organizations
Quality management organizations
 
User Guide
User GuideUser Guide
User Guide
 
Myimonlineppt
MyimonlinepptMyimonlineppt
Myimonlineppt
 
Visual_Resume
Visual_ResumeVisual_Resume
Visual_Resume
 
Laboratory quality management system
Laboratory quality management systemLaboratory quality management system
Laboratory quality management system
 
Myimonlineppt
MyimonlinepptMyimonlineppt
Myimonlineppt
 
電話営業強化の仕方 | 株式会社コンベックス
電話営業強化の仕方 | 株式会社コンベックス電話営業強化の仕方 | 株式会社コンベックス
電話営業強化の仕方 | 株式会社コンベックス
 
Excample
ExcampleExcample
Excample
 
Эволюция тренерской мысли в марафонском беге
Эволюция тренерской мысли в марафонском бегеЭволюция тренерской мысли в марафонском беге
Эволюция тренерской мысли в марафонском беге
 
Lactate profile
Lactate profileLactate profile
Lactate profile
 

Similar to Update Center API Doc

What's new in Python 3.11
What's new in Python 3.11What's new in Python 3.11
What's new in Python 3.11Henry Schreiner
 
A Tour of Building Web Applications with R Shiny
A Tour of Building Web Applications with R Shiny A Tour of Building Web Applications with R Shiny
A Tour of Building Web Applications with R Shiny Wendy Chen Dubois
 
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTechNETFest
 
Pemrograman Python untuk Pemula
Pemrograman Python untuk PemulaPemrograman Python untuk Pemula
Pemrograman Python untuk PemulaOon Arfiandwi
 
WORKING WITH FILE AND PIPELINE PARAMETER BINDING
WORKING WITH FILE AND PIPELINE PARAMETER BINDINGWORKING WITH FILE AND PIPELINE PARAMETER BINDING
WORKING WITH FILE AND PIPELINE PARAMETER BINDINGHitesh Mohapatra
 
PHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & PinbaPHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & PinbaPatrick Allaert
 
r,rstats,r language,r packages
r,rstats,r language,r packagesr,rstats,r language,r packages
r,rstats,r language,r packagesAjay Ohri
 
Web2py Code Lab
Web2py Code LabWeb2py Code Lab
Web2py Code LabColin Su
 
Sahana introduction to the code v2
Sahana   introduction to the code v2Sahana   introduction to the code v2
Sahana introduction to the code v2AidIQ
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods pptJava servlet life cycle - methods ppt
Java servlet life cycle - methods pptkamal kotecha
 
Local SQLite Database with Node for beginners
Local SQLite Database with Node for beginnersLocal SQLite Database with Node for beginners
Local SQLite Database with Node for beginnersLaurence Svekis ✔
 
Swift Bengaluru Meetup slides
Swift Bengaluru Meetup slidesSwift Bengaluru Meetup slides
Swift Bengaluru Meetup slidesPushkar Kulkarni
 
Formatting With PowerShell
Formatting With PowerShell Formatting With PowerShell
Formatting With PowerShell Thomas Lee
 
Build restful ap is with python and flask
Build restful ap is with python and flaskBuild restful ap is with python and flask
Build restful ap is with python and flaskJeetendra singh
 
Declarative UIs with Jetpack Compose
Declarative UIs with Jetpack ComposeDeclarative UIs with Jetpack Compose
Declarative UIs with Jetpack ComposeRamon Ribeiro Rabello
 
Cybersecurity Automation with OSCAL and Neo4J
Cybersecurity Automation with OSCAL and Neo4JCybersecurity Automation with OSCAL and Neo4J
Cybersecurity Automation with OSCAL and Neo4JNeo4j
 
Kafka Summit NYC 2017 - Easy, Scalable, Fault-tolerant Stream Processing with...
Kafka Summit NYC 2017 - Easy, Scalable, Fault-tolerant Stream Processing with...Kafka Summit NYC 2017 - Easy, Scalable, Fault-tolerant Stream Processing with...
Kafka Summit NYC 2017 - Easy, Scalable, Fault-tolerant Stream Processing with...confluent
 
Sahana Eden - Introduction to the Code
Sahana Eden - Introduction to the CodeSahana Eden - Introduction to the Code
Sahana Eden - Introduction to the CodeAidIQ
 
CMake Tutorial
CMake TutorialCMake Tutorial
CMake TutorialFu Haiping
 

Similar to Update Center API Doc (20)

What's new in Python 3.11
What's new in Python 3.11What's new in Python 3.11
What's new in Python 3.11
 
A Tour of Building Web Applications with R Shiny
A Tour of Building Web Applications with R Shiny A Tour of Building Web Applications with R Shiny
A Tour of Building Web Applications with R Shiny
 
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
 
Pemrograman Python untuk Pemula
Pemrograman Python untuk PemulaPemrograman Python untuk Pemula
Pemrograman Python untuk Pemula
 
WORKING WITH FILE AND PIPELINE PARAMETER BINDING
WORKING WITH FILE AND PIPELINE PARAMETER BINDINGWORKING WITH FILE AND PIPELINE PARAMETER BINDING
WORKING WITH FILE AND PIPELINE PARAMETER BINDING
 
PHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & PinbaPHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & Pinba
 
r,rstats,r language,r packages
r,rstats,r language,r packagesr,rstats,r language,r packages
r,rstats,r language,r packages
 
Web2py Code Lab
Web2py Code LabWeb2py Code Lab
Web2py Code Lab
 
Sahana introduction to the code v2
Sahana   introduction to the code v2Sahana   introduction to the code v2
Sahana introduction to the code v2
 
Capstone ms2
Capstone ms2Capstone ms2
Capstone ms2
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods pptJava servlet life cycle - methods ppt
Java servlet life cycle - methods ppt
 
Local SQLite Database with Node for beginners
Local SQLite Database with Node for beginnersLocal SQLite Database with Node for beginners
Local SQLite Database with Node for beginners
 
Swift Bengaluru Meetup slides
Swift Bengaluru Meetup slidesSwift Bengaluru Meetup slides
Swift Bengaluru Meetup slides
 
Formatting With PowerShell
Formatting With PowerShell Formatting With PowerShell
Formatting With PowerShell
 
Build restful ap is with python and flask
Build restful ap is with python and flaskBuild restful ap is with python and flask
Build restful ap is with python and flask
 
Declarative UIs with Jetpack Compose
Declarative UIs with Jetpack ComposeDeclarative UIs with Jetpack Compose
Declarative UIs with Jetpack Compose
 
Cybersecurity Automation with OSCAL and Neo4J
Cybersecurity Automation with OSCAL and Neo4JCybersecurity Automation with OSCAL and Neo4J
Cybersecurity Automation with OSCAL and Neo4J
 
Kafka Summit NYC 2017 - Easy, Scalable, Fault-tolerant Stream Processing with...
Kafka Summit NYC 2017 - Easy, Scalable, Fault-tolerant Stream Processing with...Kafka Summit NYC 2017 - Easy, Scalable, Fault-tolerant Stream Processing with...
Kafka Summit NYC 2017 - Easy, Scalable, Fault-tolerant Stream Processing with...
 
Sahana Eden - Introduction to the Code
Sahana Eden - Introduction to the CodeSahana Eden - Introduction to the Code
Sahana Eden - Introduction to the Code
 
CMake Tutorial
CMake TutorialCMake Tutorial
CMake Tutorial
 

Update Center API Doc

  • 1. Update Center Developer’s Guide Overview This document is intended to provide information about the various web requests that can be performed on the Snap Creator Update Center. Each entry details the format, parameters, and return values. Return values can be formatted in JSON, XML, or HTML. Sample codefrom Plugin Controller: def show @plugin = Plugin.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render xml: @plugin } format.json { render json: @plugin } end end Depending on which format the get request is sent, the Update Center will respond with the same format. Plugins, Agents, and Servers are able to be created, updated, shown, and deleted through web APIs using json or xml. rest-client gem Examples on how to use Rest Client: These examples and more information are located at https://github.com/rest-
  • 2. client/rest-client. RestClient.get 'http://example.com/resource' RestClient.get 'http://example.com/resource', {:params => {:id => 50, 'foo' => 'bar'}} RestClient.get 'https://user:password@example.com/private/resource', {:accept => :json} RestClient.post 'http://example.com/resource', :param1 => 'one', :nested => { :param2 => 'two' } RestClient.post "http://example.com/resource", { 'x' => 1 }.to_json, :content_type => :json, :accept => :json RestClient.delete 'http://example.com/resource' response= RestClient.get 'http://example.com/resource' response.code ➔200 response.cookies ➔{"Foo"=>"BAR", "QUUX"=>"QUUUUX"} response.headers ➔{:content_type=>"text/html; charset=utf-8", :cache_control=>"private" ... response.to_str ➔n<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"n "http://www.w3.org/TR/html4/strict.dtd">nn<html .... RestClient.post( url, { :transfer => { :path => '/foo/bar', :owner => 'that_guy', :group => 'those_guys' }, :upload => {
  • 3. :file => File.new(path, 'rb') } }) Demo Server As an example, we create a demo server that can be run by using rails server just like the normal Update Center. It should be run on a separate port and assumes that update center is running on localhost:3000 Update Center Web API Documentation Overview The formatting for these web requests will consist of basic text appended to the Update Center url plus additional parameters. For example:
  • 4. <update_center_url>/plugins/getlatestversion?name=CoolPlugin Plugins GET /plugins/getlatestversion Parameters: name - an identifier name for the plugin to get the latest version of Description: Returns the latest version of a type of plugin based on a given name. Return: name (string) - the identifying name major (int) - major version number minor (int)- minor version number revision (int)- revision version number build (int)- build version number OS (int)- compatible operating system GET /plugins/getplugins Parameters: Id?Id - identifies the ID for the plugins to check compatibility with Description: Returns true or false Return: compatible (boolean)- true if plugins are compatible, otherwise false GET /plugins/[id](.format) Description: Returns the object information Return: name (string) - the identifying name major (int) - major version number minor (int)- minor version number revision (int)- revision version number build (int)- build version number created_at (string)- Timestamp of creation updated_at (string)- Timestamp of last updated
  • 5. OS (int)- compatible operating system POST /plugins Description: Returns the information of object created Body: name, major, minor, revision, and build Return: name (string) - the identifying name major (int) - major version number minor (int)- minor version number revision (int)- revision version number build (int)- build version number created_at (string)- Timestamp of creation updated_at (string)- Timestamp of last updated OS (int)- compatible operating system PUT /plugins/[id](.format) Description: Returns the information of object updated Body: name, major, minor, revision, and build Return: name (string) - the identifying name major (int) - major version number minor (int)- minor version number revision (int)- revision version number build (int)- build version number created_at (string)- Timestamp of creation updated_at (string)- Timestamp of last updated OS (int)- compatible operating system DELETE /plugins/[id](.format) Description: Returns the information of object deleted Return: name (string) - the identifying name major (int) - major version number minor (int)- minor version number revision (int)- revision version number build (int)- build version number created_at (string)- Timestamp of creation updated_at (string)- Timestamp of last updated OS (int)- compatible operating system
  • 6. Agents /getlatestversion Parameters: name - an identifier name for the agent to get the latest version of Description: Returns the latest version of a type of agent based on a given name. Return: name (string)- the identifying name major (int)- major version number minor (int)- minor version number revision (int)- revision version number build (int)- build version number OS (int)- compatible operating system /getlatestplugins Parameters: name - an identifier name for the agent to get the latest compatible plugins for Description: Returns multiple lines for the latest versions of compatible plugins for a type of agent based on a given name. Return: name (string)- the identifying name major (int)- major version number o minor (int)- minor version number revision (int)- revision version number build (int)- build version number OS (int)- compatible operating system GET /agents/[id](.format) Description: Returns the object information Return: name (string) - the identifying name major (int) - major version number minor (int)- minor version number revision (int)- revision version number build (int)- build version number created_at (string)- Timestamp of creation updated_at (string)- Timestamp of last updated OS (int)- compatible operating system
  • 7. POST /agents Description: Returns the information of object created Body: name, major, minor, revision, and build Return: name (string) - the identifying name major (int) - major version number minor (int)- minor version number revision (int)- revision version number build (int)- build version number created_at (string)- Timestamp of creation updated_at (string)- Timestamp of last updated OS (int)- compatible operating system PUT /agents/[id](.format) Description: Returns the information of object updated Body: name, major, minor, revision, and build Return: name (string) - the identifying name major (int) - major version number minor (int)- minor version number revision (int)- revision version number build (int)- build version number created_at (string)- Timestamp of creation updated_at (string)- Timestamp of last updated OS (int)- compatible operating system DELETE /agents/[id](.format) Description: Returns the information of object deleted Return: name (string) - the identifying name major (int) - major version number minor (int)- minor version number revision (int)- revision version number build (int)- build version number created_at (string)- Timestamp of creation updated_at (string)- Timestamp of last updated OS (int)- compatible operating system
  • 8. Servers /getlatestversion Parameters: name - an identifier name for the server to get the latest version of Description: Returns the latest version of a type of server based on a given name. Return: name (int)- the identifying name major (int)- major version number minor (int)- minor version number revision (int)- revision version number build (int)- build version number OS (int)- compatible operating system /getlatestagents Parameters: name - an identifier name for the server to get the latest compatible agents for Description: Returns multiple lines for the latest versions of compatible agents for a type of server based on a given name. Return: Agent name (string)- the identifying name Agent major (int)- major version number o Agent minor (int)- minor version number Agent revision (int)- revision version number Agent build (int)- build version number Agent OS (int)- compatible operating system GET /servers/[id](.format) Description: Returns the object information Return: name (string) - the identifying name major (int) - major version number minor (int)- minor version number revision (int)- revision version number build (int)- build version number created_at (string)- Timestamp of creation updated_at (string)- Timestamp of last updated OS (int)- compatible operating system
  • 9. POST /servers Description: Returns the information of object created Body: name, major, minor, revision, and build Return: name (string) - the identifying name major (int) - major version number minor (int)- minor version number revision (int)- revision version number build (int)- build version number created_at (string)- Timestamp of creation updated_at (string)- Timestamp of last updated OS (int)- compatible operating system PUT /servers/[id](.format) Description: Returns the information of object updated Body: name, major, minor, revision, and build Return: name (string) - the identifying name major (int) - major version number minor (int)- minor version number revision (int)- revision version number build (int)- build version number created_at (string)- Timestamp of creation updated_at (string)- Timestamp of last updated OS (int)- compatible operating system DELETE /servers/[id](.format) Description: Returns the information of object deleted Return: name (string) - the identifying name major (int) - major version number minor (int)- minor version number revision (int)- revision version number build (int)- build version number created_at (string)- Timestamp of creation updated_at (string)- Timestamp of last updated OS (int)- compatible operating system
  • 10. Database Schema Overview The Update Center is a tool to help ensure compatibilities between various components of the Snap Creator Framework, such as agents, plugins, and servers. This requires a database to keep track of what versions of each component exist and what their compatibilities are. Users This table keeps track of the users in the system. It uses names and emails to help identify users and has encrypted password and remember tokens to support password- secure sessions. ID int Name string Email string Password string (encrypted) Remember token string (encrypted) Timestamp datetime Plugins/Agents/Servers Plugins/Agents/Servers need to be conscious of their name and enough information to know which version they are. They also need to know what operating system they are to disambiguate between the same version for different OSes. ID int Name string Major int Minor int
  • 11. Revision int Build int OS int Timestamp datetime Operating System index table In order to support multiple operating systems dynamically, we decided to make a table of all operating systems and use the ID associated with it to reference each operating system in plugins, agents, and servers tables. ID int Name string Architectural int Agent-Server Compatibility The compatibility matrices will simply show which agents are compatibility with which servers, given as IDs into their respective tables. These tables are implemented as a white list to show what is compatible with what. Similar tables are constructed for Plugin-Agent and Plugin-Server. Agent-ServerCompatibility Agent ID int Server ID int
  • 12. Plugin-Agent Compatibility Plugin ID int Agent ID int Plugin-Server Compatibility Plugin ID int Server ID int Seeding Database Tables Overview Ruby on rails allows an admin to create static table entries that persist through database resets. We thought it was important to have a set of foundational data preloaded into the database tables. Locating the Seed File The seed file can be found in the project directory under dbseeds.rb Editing the Seed File Open the seed file in any text editor. The first thing you may note is that line comments are generated by a '#'. Anything follow the pound sign will be commented.
  • 13. In order to make a new entry in a table, simply type the table name, followed by create, and then enter a value for each column of the table. Each column must be given a value. Auto generated values like ID or Timestamp do not need to be given a value here. Example Here is an example of adding a row to the Plugins table that contains the columns: name, major, minor, revision, build, and os Plugin.create(name: "Cool Plugin", major: "1", minor:"2", revision: "3", build:"4", OS:"1")