Representors
JSON/NodeJS edition...
Item
{
"Representer": {
// *********************************************** | |
// 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) |
/************************************************ | |
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 |
/* | |
who does it better? | |
*/ | |
// this | |
{ | |
"rel" : "http://example.org/vocabularies/customer-communiations#customers/update-name-and-sms" | |
"href" : "http://example.org/customers/123" | |
"type" : "..." | |
} |
<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" /> |
{ | |
"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", |
{
"Representer": {
**** 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 |
<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) --> |
// 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(); |
// 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 |