Skip to content

Instantly share code, notes, and snippets.

View zdne's full-sized avatar
💭
🚀

Z zdne

💭
🚀
View GitHub Profile
@zdne
zdne / blueprint1.md
Last active August 29, 2015 13:56
Experimenting with Possible API Blueprint modularity

My API

Lorem Ipsum

Group My Stuff

My Message [/message]

  • Response 200 (text/plain)

      Hello World!
    
@zdne
zdne / modeling.markdown
Last active August 29, 2015 13:56
Modeling API: Attributes vs. Relations vs. Affordances

Modeling API

Question: Affordances or web link relations for modeling your API?

I have been pondering this question a lot lately. Given a resource and its attributes (semantic descriptors), would you model the API using the link / relations or resource affordances? May one relation as defined by RFC5988 Web Linking imply multiple affordances? For example does the edit relation represents three affordances (retrieve, update, and delete)?

Is (should?) the perspective affordances vs. relations differ based on the point of view (API design, client, server).

Most of the hypermedia media types such as HAL, Collection+JSON and JSON API are built around link relations. Seems that on

@zdne
zdne / gist:9333604
Created March 3, 2014 20:12
Trivial express.js app in CoffeeScript
express = require 'express'
app = express()
PORT = 1234
app.get '/machines', (req, res) ->
res.setHeader 'Content-Type', 'application/json'
machine =
type: 'bulldozer'
name: 'willy'
@zdne
zdne / gist:55b7a38f52ca642e123b
Created April 30, 2014 09:43
New API Blueprint parser structure
#include <string>
#include <vector>
#include <regex>
enum MarkdownNodeType {
RootMarkdownNodeType = 0,
HeaderMarkdownNodeType,
ListItemMarkdownNodeType,
ParagraphMarkdownNodeType,
UndefinedMarkdownNodeType = -1
@zdne
zdne / HAL.markdown
Last active August 29, 2015 14:04
HAL description in MSON

HAL Object

  • _links - Links (to URIs)
    • {relation name}

      A resource may have multiple links that share the same link relation. For link relations that may have multiple links, we use an array of links.

@zdne
zdne / stackedittest
Created August 11, 2014 20:30
Gist%20Fox%20API%20%2B%20Auth.md
FORMAT: 1A
# Gist Fox API
Gist Fox API is a **pastes service** similar to [GitHub's Gist](http://gist.github.com).
## Authentication
*Gist Fox API* uses OAuth Authorization. First you create a new (or acquire existing) OAuth token using Basic Authentication. After you have acquired your token you can use it to access other resources within token' scope.
## Media Types
Where applicable this API uses the [HAL+JSON](https://github.com/mikekelly/hal_specification/blob/master/hal_specification.md) media-type to represent resources states and affordances.
@zdne
zdne / outline.markdown
Last active August 29, 2015 14:09
API Blueprint Outline

$KEY: $VALUE

$API_NAME

$DESCRIPTION

group $GROUP_NAME

$DESCRIPTION

$RESOURCE_NAME [$URI_TEMPLATE]

$DESCRIPTION

#!/bin/bash
echo -n "GitHub User: "
read USER
echo -n "GitHub Password: "
read -s PASS
echo ""
echo -n "GitHub Repo (e.g. foo/bar): "
@zdne
zdne / MSON.apib
Last active August 29, 2015 14:27
Simplest possible API Blueprint with MSON
# Data Document
This document contains a description of a data.
# Data Structures
## Some Data (object)
- name: Z (string) - Good old name.
@zdne
zdne / BasicExample.md
Last active December 13, 2015 21:28
Deprecated. This is an example file for the upcoming Apiary.io blog post on New API Blueprint Format.

Format: 1A Host: http://blog.acme.com

Basic ACME Blog API

NOTE: This document is outdated. Refer to the actual API Blueprint examples.

Welcome to the ACME Blog API. This API provides access to the ACME Blog service.