Skip to content

Instantly share code, notes, and snippets.

View zdne's full-sized avatar
💭
🚀

Z zdne

💭
🚀
View GitHub Profile
@zdne
zdne / howto.md
Last active January 4, 2016 03:08

How to convert a legacy Apiary Blueprint to API Blueprint using CLI

CLI Tools Required

Install following CLI tools:

  1. Apiary Blueprint Parser

    $ npm install apiary-blueprint-parser
@zdne
zdne / gist:8649615
Created January 27, 2014 14:37
Sublime Text 3 as default git editor
$ git config --global core.editor "subl -n -w"
@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): "