REST Protocol

From the Rebol Console:

read [
scheme: 'rest

The REST Protocol offers an exchange-oriented implementation of HTTP. Unlike Rebol’s built-in HTTP Protocol, REST gives you greater access to both Request and Response headers in order to better access third-party APIs. Additionally, REST has OAuth signing built-in for all those hard-to-reach sites.


Making requests is easy, just use ‘read.

read [
scheme: 'rest

Using OAuth is as straightforward as adding the various keys and secrets:

read [
scheme: 'rest
oauth: [
Consumer-Key: "...App Key..."
Consumer-Secret: "...App Secret..."
OAuth-Token: "...User Token..."
OAuth-Token-Secret: "...User Secret..."

You can also add some parameters to your request with read/custom:

read/custom [
scheme: 'rest
action: 'post
oauth: :my-oauth-settings
param1: "This"
param2: "That"

And a short-form url is available:

read rest://
; short-form does not accommodate HTTPS


The Response object gives you immediate access to the HTTP status code and headers:

>> page: read rest://
>> ? page
PAGE is an object of value:
status integer! 200
message string! "OK"
http-headers block! length: 14
headers object! [Date Server Last-Modified Accept-...
content string! {<!doctype html> <html><head> <met...
binary binary! #{ 3C21646F63747970652068746D6C3E0...
type path! length: 2
length integer! 9379


  • This version of the REST Protocol does not use Rebol’s built-in TCP Ports, rather uses the cURL shell command. cURL is available by default on most Unix/Linux/Mac OS X installations, and is generally available for most platforms. cURL is used to allow HTTPS support from the Rebol/Core interpreter.
  • This should work within most Shell environments, I have tested on CSH, BASH and SH.
  • A version of this script that uses Rebol’s internal TCP protocol is available at:
    Rebol REST; though has some caveats.
  • Please direct any questions/suggestions for now to my Twitter account: @rgrebol