Skip to content

Instantly share code, notes, and snippets.

Avatar

Mike Amundsen mamund

View GitHub Profile
@mamund
mamund / person-uber.html
Last active May 28, 2021
an UBER representation (and resulting HTML document) that uses transclusions
View person-uber.html
<html>
<head>
<title>Person</title>
<link rel="related" href="http://example.org/uber/person-uber.xml" />
</head>
<body>
<dl>
<dt>NAME:</dt>
<dd>Mike Amundsen</dd>
<dt>PHOTO:</dt>
@mamund
mamund / setAuth0JWT.js
Last active May 5, 2021
auth0 JWT in Postman API Testing
View setAuth0JWT.js
/************************************************
Retrieve a JWT from Auth0 for Postman
2020-05-15 : @mamund @greatwebapis
NOTES:
1) create API definition in Auth0 with
"client_credential" (machine-to-machine)
2) pull the following from Auth0 API config:
- domain
@mamund
mamund / suggest-working.md
Last active Mar 12, 2021
Working Skeleton for HAL-FORMS SUGGEST control
View suggest-working.md

Below is an updated workinging model for HAL-FORMS options control. See notes below for details. Comments welcome.

{
  "_templates" : {
    "default" : {
      ...
      "properties" : [
        {
          "name" : "...", 
View products-alps.xml
<alps version="1.0">
<link rel="help" href="http://example.org/documentation/products.html" />
<doc>
This is a prototype product API.
</doc>
<!-- transitions -->
<descriptor id="item" type="safe" rt="#product">
<doc>Retrieve A Single Product</doc>
</descriptor>
@mamund
mamund / def-sample.xml
Last active Aug 17, 2020
ALPS document w/ various examples of the `def` element
View def-sample.xml
<alps>
<doc>Sample Service</doc>
<!-- properties -->
<descriptor id="identifier" def="https://schema.org/identifier" />
<descriptor id="givenName" def="https://schema.org/givenName" />
<descriptor id="familyName" def="https://schema.org/familyName" />
<descriptor id="status" def="https://schema.org/status" />
<descriptor id="dateCreated" def="https://schema.org/dateCreated" />
<descriptor id="dateModified" def="https://schema.org/dateModified" />
@mamund
mamund / api-design-example.xml
Last active Aug 17, 2020
API Design Example
View api-design-example.xml
<alps>
<doc>Simple Banking Example</doc>
<!-- actions -->
<descriptor id="getList" type="safe" />
<descriptor id="getStatus" type="safe" />
<descriptor id="updateStatus" type="idempotent">
<descriptor href="#accountId" />
<descriptor href="#actionStatus" />
</descriptor>
<descriptor id="updatePreferences" type="idempotent">
@mamund
mamund / loadUtils.js
Created May 20, 2020
Mike Amundsen's Postman Utilities
View loadUtils.js
// ***********************************************
// Testing Utilities
// 2020-04 : @mamund
//
// NOTE:
// store in global variables
// load in Postman pre-request script block:
// var utils = eval(globals.loadUtils);
// use as needed:
// utils.checkStatus(200)
@mamund
mamund / 2020-01-23b.js
Last active Jan 24, 2020
self-describing messages
View 2020-01-23b.js
/*
who does it better?
*/
// this
{
"rel" : "http://example.org/vocabularies/customer-communiations#customers/update-name-and-sms"
"href" : "http://example.org/customers/123"
"type" : "..."
}
@mamund
mamund / actions-01.json
Last active Nov 5, 2018
2018-11-OSLC-Gists
View actions-01.json
{
"task": [
{
"url" : "http://api.examples.org/137h96l7mpv",
"edit" : "http://api.examples.org/edit?id=137h96l7mpv",
"id": "137h96l7mpv",
"title": "LAX",
"completeFlag": "true",
"assignedUser": "bob",
"dateCreated": "2016-01-14T17:48:42.083Z",
View representer-json.md

Representors

JSON/NodeJS edition...

Item

{
  "Representer": {