Skip to content

Instantly share code, notes, and snippets.

Avatar

Mike Amundsen mamund

View GitHub Profile
@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 / setAuth0JWT.js
Last active May 21, 2020
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 / 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 / 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 / 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": {
@mamund
mamund / bulk-update.txt
Last active Jul 23, 2018
sample "bulk update" over http
View bulk-update.txt
**** REQUEST ****
GET /bulk-users?list=1,2,3 HTTP/1.1
HOST: example.org
**** RESPONSE ****
HTTP/1.1 200 OK
Location: http://bulk-users?list?1,2,3
ETag: "1q2w3e4r5t"
Content-Type: application/ps.bulk+json
View 01-h-factors.html
<html>
<body>
<!-- Link Embed (LE) -->
<img src="http://www.example.org/images/logo" title="company logo" />
<!-- Link Outbound (LO) -->
<a href="http://www.example.org/search" title="view search page">Search</a>
<!-- Link Template (LT) -->
@mamund
mamund / client.js
Last active Jun 20, 2017
hypermedia examples
View client.js
// init library and start
function init(url, title) {
g.url = url;
g.title = title||"Cj Client";
req(g.url,"get");
}
// primary loop
function parseCj() {
dump();
View publish-data.js
// Initialize WebHooks module.
var WebHooks = require('node-webhooks')
var webHooks = new WebHooks({db: './webHooksDB.json'}) // json file that store webhook URLs
// sync instantation - add a new webhook called 'shortname1'
webHooks.add('shortname1', 'http://www.webapp.com/resources/shortname1').then(function(){
// done
}).catch(function(err){console.log(err)})
// add another webHook
You can’t perform that action at this time.