You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lampapos edited this page Sep 10, 2014
·
4 revisions
Helium is a DSL for REST API specifications and also a Java API for processing descriptions written in this language.
How to write a spec
Our main purpose is to describe some REST service API. We start with naming, small description, and base service URI.
service {
name 'Twitter API'
description 'Piece of Twitter API'
version 1.1
location "https://api.twitter.com/${version}"
}
Now we describe the first method which returns user profile:
// This is a description of user profile response structure
type "UserProfile" message {
id long required
screen_name 'string' required
profile_image_url_https 'string' optional
}
service {
// ...// Here's our method description
get "/users/show.json" spec {
name 'Get user profile'
description ''' Returns a variety of information about the user specified by the required user_id or screen_name parameter. The author's most recent Tweet will be returned inline when possible.'''
parameters {
user_id long optional
screen_name 'string' optional
include_entities boolean optional
}
response "UserProfile"
}
}