Murphy s Magic Download API

Similar documents
Connecting VirtueMart To PayPal (Live)

AutomationDirect.com Order Import Feature

DPD API Reference Documentation

Note about compatibility: This module requires that PHP is enabled on the server. You should verify that your host offers PHP prior to installation.

U. S. AIR FORCE. Air Force Way. User Guide RFQs / Waivers / Orders / Reports. Version Release # S March 20, 2018

Using the Control Panel

Selling items that your customers can download

Smart Bulk SMS & Voice SMS Marketing Script with 2-Way Messaging. Quick-Start Manual

ChatBlazer 8 Site Administrator Usage Guide

Magento Extension User Guide: Web Services Version 3.6.1

eshop Installation and Data Setup Guide for Microsoft Dynamics 365 Business Central

Way2mint SMS Mobile Terminate (MT) API Guide for HTTP HTTPS

Contents OVERVIEW... 3

Entering an erequest for Stores

Donation Cart. User Guide

Webshop Plus! v Pablo Software Solutions DB Technosystems

Entering an erequest. Login Page

External Linkage

Important Notice. Important Notice

Entering an erequest. Login Page

Administrator Quick Guide

Bravo Integration Admin Guide Basware P2P 18.1

E-Commerce Web Application

ECSI HELP DOCUMENT Jones & Bartlett Learning, LLC, An Ascend Learning Company

SMS4BD Gateway Integration

XML and API Documentation

1 Virtual Terminal Quick Reference Guide. Virtual Terminal Quick Reference Guide. Getting Started

RESTFUL WEB SERVICES - INTERVIEW QUESTIONS

Introduction. Installation. Version 2 Installation & User Guide. In the following steps you will:

ewallet API integration guide version 5.1 8/31/2015

Blackinton Design A Badge IFRAME/ Integration

University of British Columbia Okanagan. COSC Project Design

Final Documentation. Created By: Ahnaf Salam Adam Castillo Sergio Montejano Elliot Galanter

ACCUZIP EDDM UI REST API CALLS. 100% Cloud Based EDDM List Creation. Abstract EDDM UI to select Carrier Route Boundaries throughout the United States

SelectSurveyASP Advanced User Manual

SEGPAY WooCommerce Plugin SETUP

MySagePay USER GUIDE

Baobab Ebooks. Patron s User Guide

SmartFocus Cloud Service APIs

Instructions for First Time Users

Steps A. Identify version number B. Access configuration page C. Basic settings D. Advance settings E. Front end experience settings F.

Open 24/7/365. Welcome to DOIGCorp.com. Welcome to the new DOIGCorp.com

Setting Up Resources in VMware Identity Manager

magento_1:full_page_cache

How to order uniforms through Corporate Recognition

2. On completing your registration you will get a confirmation . Click on the link or paste the link into your browser to validate the account.

SMS Plugin for WooCommerce Manual

PLEXUS PAY PORTAL YOUR HOW-TO GUIDE

Introduction. Typographical conventions. Prerequisites. QuickPrints SDK for Windows 8 Version 1.0 August 06, 2014

Greater Giving Online Software Go Time

PLR-MRR-Products.com 1

Design Gallery User Guide

U s e r s g U i d e 1

Resurs Bank. Magento 1 module. Checkout

D&B Web Visitor ID for Adobe Analytics Deployment Guide

PayPlug. The payment solution that increases your sales PAYPLUG EXTENSION FOR MAGENTO V1

Version 3.3 System Administrator Guide

Connect-2-Everything SAML SSO (client documentation)

EMARSYS FOR MAGENTO 2

Lecture 9a: Sessions and Cookies

Administering Workspace ONE in VMware Identity Manager Services with AirWatch. VMware AirWatch 9.1.1

Single Sign-on Overview Guide

ClickBetter IPN Documentation

PHPBasket 4 Administrator Documentation

A Step By Step Guide To Use PayPal

magento_1:full_page_cache

Vingd API for PHP Documentation

BrainCert Enterprise LMS. Learning Management System (LMS) documentation Administrator Guide Version 3.0

NATIONAL ACCOUNTS PROGRAM BENEFITS: INFORMATION AND ASSISTANCE:

Resellers Guide Managing your Reseller Account

Getting Started Guide. Prepared by-fatbit Technologies

ONE STEP CHECKOUT USER GUIDE

1/ , DNN Sharp

New BoundTree.com User Guide Fall Version 6

Quick Shopper Online Store KB P M P D P D

WEBSITE TRAINING GUIDE MY OFFICE PRODUCTS. Office Supplies & Business Print

Guide to creating an account and entering your business information in the. Central Kootenay Farm & Food Directory

RQs + PEs: More Servlets

Energy and Resource Development (ERD) Fish and Wildlife e-licensing System. Vendor User Guide

Getting Started with. InSpiredByYou.com COPYRIGHT STUDIOPLUS SOFTWARE, LLC ALL RIGHTS RESERVED

Sophos Mobile Control Network Access Control interface guide. Product version: 7

Your Guide to Access the 2011 USDAA / Cynosport World Games Dog Agility Championships

Welcome to the USF Computer Store Web Store. Or navigate directly to:

CPM Quick Start Guide V2.2.0

Self-Service Portal & estore Guide. Your complete guide to installing, administering and using the 1CRM Self-Service Portal and estore.

VALO ecommerce User Guide. VALO Commerce

What are Non-Catalog Orders?

Catalogue Search & Browse

How to Create a Dell Punchout in PeopleSoft. A Quick Reference Guide for Dell Punchout Procurement February 2016

KioskWatch Remote Users Guide

Bruce Moore Fall 99 Internship September 23, 1999 Supervised by Dr. John P.

Quick Reference Guide For Users. Easy ordering with Staples Advantage

Void Mark E-Commerce Application

CRM Service Wrapper User Guide

Joomeo API XML-RPC: Reference guide

Mobile Login extension User Manual

CONVERSION TRACKING PIXEL GUIDE

Destiny Library Manager

Gift Cards. User Guide

B2B Portal User Guide

Transcription:

Murphy s Magic Download API Last updated: 3rd January 2014 Introduction By fully integrating your website with the Murphy s Magic Download System, you can give the impression that the downloads are fully hosted on your website. It also allows you to manage the complete user experience. Note that this service is only suitable for experienced web developers. You would not be able to integrate the system using our API if you do not have web development skills. If you are not an experienced web developer, we suggest that you use our easy integration option which is available from the downloads admin area and takes just a few minutes to set up. Is the API suitable for my website? The API is designed specifically for magic shops that meet the following criteria: You are able to write code such as C# or PHP, or have a web developer who can do the work for you. A basic understanding of posting form data and parsing JSON is also required. You have a member s area (or can develop one) that allows customers to log in to view their downloads. You will be required to authenticate your customers in order to use the system. If you have already integrated Murphy s Web Services you will find this integration a lot easier as you will need to use that API to import downloads into your website (all downloads act as a normal Murphy s product and are therefore returned by Web Services). If you do not feel as though this API is for you, you can still sell downloads and integrate them into your website easily. Follow the instructions on the Set up your website area of the downloads admin page.

Understanding the basics of the API API Key Each call to the API must include your unique API key. It is essential that you keep this key private as it would allow anyone to make calls to the API and that could cost you money if someone used it to purchase downloads on your account. Your API key can be found within your account area of the downloads website. Making a Call to the API The system using a very basic JSON API. You must simply make a HTTP POST request to the specific call s URL and you will receive JSON data in response. For example, to get a customer s details, you would submit a POST request containing two fields: APIKey (this is required for all calls) and Email (the customer s email address) to the following URL: http://downloads.murphysmagic.com/api/getcustomer/ An example of the JSON data that you would receive back is: ID :1, EmailAddress : customer@customer.com, FirstName : Bob, LastName : Customer, Password : asdsds4r, CustomerId :2, TimeSignedUp : \/Date(1352474848983)\/ Each language handles JSON in different ways. The API always returns standard JSON and therfore should be easy to parse into your website. Handling Errors Errors are always presented in the same JSON format, as follows: error : Email not passed Error messages are written in such a way that you could display them to the user. However, a full list of errors for each call are included at the end of this document, should you wish to catch them and rewrite them.

Testing the API The easiest way to get started and to test the API is without our API tester tool which allows you to make real calls (with the exception of a few test calls) to the API is here: http://downloads.murphysmagic.com/account/api/documentation/ Example User Flow It is entirely up to you how you display the downloads within your website. However, we suggest that you use the following basic flow: 1. Add downloads during checkout STEP 1: At the end of your checkout (after payment has been confirmed), call the AddOrder command to add a purchase for the customer. If you do not already have a username and password stored for the customer, you would need to have them create on during the checkout process. STEP 2: Email the customer with a link to your downloads page and/or take them straight to that page. 2. List the customer s downloads within your account area Autenticate the customer (it is assumed that you already have an account area STEP 1: and therefore do this within your website). STEP 2: STEP 3: STEP 4: Display a full list of downloads that the customer has purchased using the GetDownloadsForCustomer command. You may also like to store this information within your own database. Video only: Display a page that plays the video. You can get the streaming URL for a video with the GetVideoStreamURL call. You will need to make this call every time the user plays the video as the URL expires (this is to stop users being able to download the video stream). Allow the user to download videos or ebooks by calling the GetDownloadLink command. This command will be explained further in the Downloading videos and ebooks section as there are a number of things that need to be taken into consideration.

3. Let us know when a customer changes their email address STEP 1: As all downloads are authenticated based on the customer s email address, please call the UpdateCustomerEmailAddress command whenever the customer changes their email address. Purchasing a Product for a Customer When a customer purchases a download, simply call the AddOrder command passing the following fields: FirstName LastName Email ProductIds (a comma separated string of product IDs) If a user with that email address already exists, we will add the purchases to their account within the download system. Otherwise, we will create a new account for them. Because ProductIds is a comma-separated list, you can add as many downloads to the customers account as you like in one go. The ProductId is Murphy s product ID as provided via webservices. A successful purchase is returned as a JSON string as follows: message : success Like all calls with the API, any errors are display as follows: error : error description You can view all the possible errors for this call at the end of this document.

Displaying a Customer s Purchases To display a customer s purchases, you simply need to call GetDownloadsForCustomer with the following two fields: APIKey Email (email address of the customer) You will receive a JSON response with a comma separated list of product IDs in this manner: [45234,34555] (Note that unlike the calls that we have previously discussed, this is a JSON array and not a JSON object. It is possible that your language requires you to parse it differently). You probably already store the products in your shopping cart with the same IDs and therefore can get information about each product from your database. However, if you prefer, you can get the product info by calling the GetDownload command with the following POST fields: APIKey DownloadID This returns a JSON object as follows: ID :46478, Name : Mirage Et Trois by Eric Jones, CreatorName : Jones, Eric, Price :25.00, Type : Video, LiveStreamStartTime :null, NumberOfVideos :1 This is a good time to discuss an important concept of the download system. Each download could have any number of files associated with it. For example, some DVD sets have as many as eight DVDs and therefore the download version has eight separate files; one for each DVD. You can find out how many files each download has associated with it by checking the NumberOfVideos paramater of the above call. Each file is considered a part and therefore if you want to get the second video you would request part 2. This is covered in detail in the download section. An ebook, however, has only one file ever associated with it.

Playing a Streaming Video To embed the download within your website, you will need to use a Flash or HTML5 video player such as Flowplayer or JW Player. In particular, you need to use these players in RTMP mode. Documentation for this mode for the players cane be found here: Flowplayer: http://flash.flowplayer.org/plugins/streaming/rtmp.html JW Player: http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/12535/ video-delivery-rtmp-streaming All players will require two things to play the video: the server URL and the video filename. The server URL is always the same: rtmp://s2tvq8gbnu2j5w.cloudfront.net/cfx/st/ The video filename must be generated each time the user plays the video. This is for security and ensures that only one customer can play the video. Therefore, you must call the command GetVideoStreamURL with the following parameters to get the URL: APIKey DownloadID Email (the customer s email address) You will receive a filename in the following format: 1-1.mp4%3fExpires%3d1352569481%26Signature%3dA-WZMrfMsOSC yqajbhzlbag4mdudf0lfz50aqihwsmsboa0mhcztu2icpgm8b%7eq%7ehr OEIuccVv-TKbqdRVRvTN9t9jWwPEDssrOSdavCCabaqU0rtUpNxecEVtxm yh1jizwpwg5syx2pj1wmqhwxd9dmkacs1jq4iwqfqx-q_%26key-pair- Id%3dBDKAJPA4CHYQ3EKWUVHQ Note this this is just a string and not a JSON object. The video link expires 30 seconds after it is generated and therefore you must set your video player to auto play to ensure that the video is played within the correct amount of time. Ebooks cannot be opened online. They must be downloaded (as per the next section).

Downloading files Most magic vendors opt for us to watermark their files with the customers name. Watermarking ebooks is immediate, whereas watermarking videos can take up to an hour to process. Downloading videos Your user interface should handle this flow for videos: 1. Customer requests to download video 2. You can display the progress of the download 3. You email the customer when the download is complete (this is achieved via a callback, which we ll cover shortly). First, you start by calling the GetDownloadLink command with the following parameters: APIKey Email (email address of the customer) ProductID Part or FileID CallbackURL (optional) A note about parts The part is the part number of the video. For example, if the video has six separate files associated with it (see more info on how to get the number of files in the Displaying a Customer s Purchases section) and you wanted to watermark the first part, you would enter 1 as the part. Some downloads have multiple parts. This could be because the video is too long, it was originally on multiple DVDs, or there are different file types (such as an ebook and a video) part of the download. To get full details about the file parts, simply call GetDownloadFiles with DownloadID. For ease, you can normally just pass a part ID. But if the download type (you can see the type in the GetDownload call) is Mixed then you would need to call GetDownloadFiles so that you can see the file type for each invidual file (current file types:.mp4 and.pdf. All functions that accept Part also accept FileID. How this call works This function does one of two things. If the download is not yet queued, it will queue it for the customer. If it is queued, it will return the current status of the download. Important: it is possible that a creator may want to not allow downloading; only streaming

(example: if the file is regularly updated). In this instance, you will receive an error of Download not allowed. You can also check whether a file can be followed by checking the CanDownload parameter of the download object. At the time of writing, all files can be downloaded but you should still check this, just in case that changes. The JSON response from this call is as follows: PercentComplete: 0, RequestTime : \/Date(1352474848983)\/, Status : queued DownloadLink : The key here is to always check the status. The possible options are: queued (video is waiting to be watermarked) watermarking (video is currently being watermarked. Check the PercentComplete column to see the progress) ready (the file can be downloaded. Send the user to the URL provided in DownloadLink. This will only be populated when the file is in this state) It is important to note that the URL provided in DownloadLink will expire after a few seconds. We suggest that you create a page that authenticates the user and then redirects them (for example using Response.Redirect for ASP.NET or changing the headers for PHP) to the DownloadLink URL. This way, you can maintain the same URL (such as www.yoursite.com/ download/?download=123), authenticate the user and always provide the latest URL. If you would just like to get the status of a download (and not queue it if it isn t already queued) you can call the GetDownloadLinkStatus call with the same paramaters. This will not queue a download. The response is identical, however, the following status might be returned: notqueued (there is no download queued for the user) CallbackURL Once a download has been watermarked, you ll need to let the customer know. The easiest way to do this is to pass a callback URL to a script on your website. This URL can be a page on your site that then runs a script to email the customer. Whatever URL you pass, we will add three querystring paramaters as follows:

CustomerEmail (the customer s email address) DownloadID (the ID of the download) Part (the part number) You will need to URLDecode the CustomerEmail paramater. An example script (in C#) could be: protected void Page_Load(object sender, EventArgs e) // The three paramaters passed by Murphy s if (!string.isnullorempty(request. QueryString[ CustomerEmail ]) &&!string. IsNullOrEmpty(Request.QueryString[ DownloadID ]) &&!string.isnullorempty(request.querystring[ Part ])) string email = HttpUtility.UrlDecode(Request. QueryString[ CustomerEmail ]); Cust cust = GetCustomerByEmail(email); if (customer!= null) // Email the customer here Downloading ebooks This is the easiest option. An ebook will always have the Status of ready and the DownloadLink will always be in place. Therefore, you can simply forward the customer to the link provided in DownloadLink. Like all other URLs in this system, the link will expire a few seconds after generating is so you will need to create a page to forward the user to the link (being sure to authenticate them within your system first).

Changing a Customer s Email Address Customers are identified by an email address. Therefore, if they ever change their address within your system, you will need to identify us. This is a simple call to UpdateCustomerEmailAddress with the following paramaters: APIKey OldEmail NewEmail Other than an error, you will only ever receive this message: message : success

Live Lectures As far as purchasing is concerned, live lectures and season passes using the same API function calls (AddOrder). Similarly, the same API is used to list the customer s access to a live lecture. The only change comes when viewing the live lecture. Simply follow these two steps: STEP 1: Call GetLiveLectureLoginURL with the following info: Email (the customer s email address) ProductID (the MMS product ID for the lecture) STEP 2: This call with return a secure URL to allow the customer to view the live lecture. Embed that URL as an iframe into your page (with a height of at least 1000px. A few useful API calls You may find the following API calls useful: GetSeasonPassLectures (input: ProductID): returns an array of products within a season pass. IsLectureLive (input: ProductID): returns true/false if a lecture is currently on air.

List of Errors GetCustomer Customer not found Email not passed GetCustomers Invalid letter GetDownloadsForCustomer No downloads Customer not found Email not passed GetDownload Download not found DownloadID not passed GetVideoStreamURL DownloadID not passed Email not passed Part does not exist Not a stream DownloadID in incorrect format Customer not found The email address does not exist in the database. You did not pass the Email post field. You can optionally pass a letter to filter by (first letter of last name), but you did not pass a correct letter (A-Z only) This customer has not purchased any downloads. The email address does not exist in the database. You did not pass the Email post field. Couldn t find a downloading matching the ID you passed. You did not pass the DownloadID post field. You did not pass the DownloadID post field. You did not pass the Email post field. The part you give is more than the number of parts in the download. You can t stream this download (it s likely an ebook). The DownloadID was not an integer. The customer does not exist. GetDownloadLink and GetDownloadLinkStatus Part not found Access denied Customer not found ProductID not passed Email not passed Download not allowed AddOrder Invalid email address No first name passed The part you give is more than the number of parts in the download. Customer does not have permission to download this file. Could not find a matching customer. You did not pass the ProductID post field. You did not pass the Email post field. The manufacturer has opted for this download to be streaming only You did not pass the Email post field (or invalid address). You did not pass the FirstName post field.

No last name passed No products submitted UpdateCustomerEmailAddress OldEmail not passed NewEmail not passed NewEmail not valid Customer not found You did not pass the LastName post field. You did not pass the ProductIDs post field. You didn t supply the OldEmail field You didn t supply the NewEmail field NewEmail is not a valid email address The customer you enetered does not exist