Skip to content

Instantly share code, notes, and snippets.

View jcleblanc's full-sized avatar

Jonathan LeBlanc jcleblanc

View GitHub Profile
@jcleblanc
jcleblanc / subscription_billing.js
Created June 26, 2014 05:58
paypal_rest_subscriptions_billing_agreement
curl -v POST https://api.sandbox.paypal.com/v1/payments/billing-plans \
-H 'Content-Type:application/json' \
-H 'Authorization: Bearer {accessToken}' \
-d '{
"name": "Fruit of the Month",
"description": "10 Pound Box of Fruit",
"type": "fixed",
"payment_definitions": [
{
"name": "Standard Package",
@jcleblanc
jcleblanc / example.php
Created August 23, 2012 20:36
eBay Finding API Samples
<?php
require_once("finding.php");
$ebay = new ebay();
//search by keyword - keywords can be space separated list of searches
print_r($ebay->findProduct('findItemsByKeywords', 'Dresses Pants', 2));
//search by category - dresses = 63861, pants = 63863
print_r($ebay->findProduct('findItemsByCategory', '63861', 2));
@jcleblanc
jcleblanc / pp_oauth2_token.php
Created April 2, 2013 16:13
Fetching an OAuth 2 bearer token from PayPal
<?php
class paypal{
private $access_token;
private $token_type;
/**
* Constructor
*
* Handles oauth 2 bearer token fetch
* @link https://developer.paypal.com/webapps/developer/docs/api/#authentication--headers
Steps to creating a machine learning system
1. Create your JWT application with Box
2. Set up a webhook on a folder
3. Set up a lambda to listen for the webhook notifications
4. Upload a file using the Box file API (this will trigger your webhook)
5. Read in the file from Box and upload the file to your preferred machine learning system
6. When the machine learning system sends a notification (after processing the file) upload the new data (via the Box metadata API) to the file.
Resources
@jcleblanc
jcleblanc / box_webhook_folder_create.js
Created September 11, 2018 18:51
Create a webhook on a folder in Box to listen for file upload events
'use strict';
// Initialize packages
const util = require('util'); // Deep inspection of objects
const boxSDK = require('box-node-sdk'); // Box SDK
const fs = require('fs'); // File system for config
// Fetch config file for instantiating SDK instance
// SAVE YOUR OWN APP CONFIG FILE TO config.json
const configJSON = JSON.parse(fs.readFileSync('config.json'));
@jcleblanc
jcleblanc / quickstart_auth_oauth_start.java
Last active November 8, 2017 23:12
Quickstart OAuth auth samples - Redirect the user to Box
// Redirect user to login with Box
String box_redirect = Config.box_redirect
+ "?response_type=code"
+ "&client_id=" + Config.client_id
+ "&redirect_uri=" + Config.redirect_uri;
res.redirect(box_redirect);
@jcleblanc
jcleblanc / shopping.php
Created August 30, 2012 20:37
eBay Shopping API Samples
<?php
class eBayShopping{
//variable instantiation
private $uri_shopping = 'http://open.api.ebay.com/shopping'; //Production Shopping API endpoint
private $appid = 'YOUR APPLICATION ID'; //Production application ID
private $version = '787'; //API version
private $format = 'JSON'; //API response format
private $siteid = '0'; //Site to search (Currently U.S.) - full site list at http://developer.ebay.com/devzone/shopping/docs/callref/types/SiteCodeType.html
private $standard_qstring = ''; //Standard query string parameters to be applied to all requests
@jcleblanc
jcleblanc / plugin.xml
Created December 6, 2011 18:47
Sample Eclipse Plugin plugin.xml file
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<!-- Toolbar Dropdown Menu -->
<extension point="org.eclipse.ui.commands">
<category id="com.x.sampleplugin.dropdown.category" name="Sample Plugin DropDown"></category>
<command categoryId="com.x.sampleplugin.dropdown.category" id="com.x.sampleplugin.dropdown.command" name="DropDown">
<commandParameter id="com.x.sampleplugin.dropdown.msg" name="DropDown Options" optional="true"></commandParameter>
</command>
<command categoryId="com.x.sampleplugin.dropdown.category" id="com.x.sampleplugin.dropdown.commandProfile" name="Profile">
curl https://svcs.sandbox.paypal.com/Permissions/RequestPermissions -s --insecure -H "X-PAYPAL-SECURITY-USERID: caller_1312486258_biz_api1.gmail.com" -H "X-PAYPAL-SECURITY-PASSWORD: 1312486294" -H "X-PAYPAL-SECURITY-SIGNATURE: AbtI7HV1xB428VygBUcIhARzxch4AL65.T18CTeylixNNxDZUu0iO87e" -H "X-PAYPAL-REQUEST-DATA-FORMAT: JSON" -H "X-PAYPAL-RESPONSE-DATA-FORMAT: JSON" -H "X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T" -d '{"scope":"EXPRESS_CHECKOUT", "callback":"http://www.example.com/success.html", "requestEnvelope": { "errorLanguage":"en_US" }}'
@jcleblanc
jcleblanc / auth_return.json
Created May 31, 2013 15:30
HATEOAS link return structure from a successful auth request through the PayPal REST APIs
"links":[
{
"href":"https://api.sandbox.paypal.com/v1/payments/authorization/9T287484DP554682S",
"rel":"self",
"method":"GET"
},
{
"href":"https://api.sandbox.paypal.com/v1/payments/authorization/9T287484DP554682S/capture",
"rel":"capture",
"method":"POST"