CPSC Recalls Retrieval Web Services Programmers Guide: Recalls and Penalties Database



Similar documents
Forefront Online Protection for Exchange (FOPE) User documentation

Filtering with Microsoft Outlook

Candle Ring Recalled by Yankee Candle Due to Fire Hazard

How To Test Your Web Site On Wapt On A Pc Or Mac Or Mac (Or Mac) On A Mac Or Ipad Or Ipa (Or Ipa) On Pc Or Ipam (Or Pc Or Pc) On An Ip

Cloud Elements! Marketing Hub Provisioning and Usage Guide!

Using SQL Server Management Studio

Load testing with. WAPT Cloud. Quick Start Guide

Adding Links to Resources

Aras Corporation Aras Corporation. All rights reserved. Notice of Rights. Notice of Liability

How To Use Query Console

CSCI110: Examination information.

How To Use Databook On A Microsoft Powerbook (Robert Birt) On A Pc Or Macbook 2 (For Macbook)

A Model of the Operation of The Model-View- Controller Pattern in a Rails-Based Web Server

Up and Running with LabVIEW Web Services

Internet/Intranet, the Web & SAS. II006 Building a Web Based EIS for Data Analysis Ed Confer, KGC Programming Solutions, Potomac Falls, VA

Hamline University Administrative Computing Page 1

Fax User Guide 07/31/2014 USER GUIDE

Query JD Edwards EnterpriseOne Customer Credit using Oracle BPEL Process Manager

WEB DEVELOPMENT COURSE (PHP/ MYSQL)

Point Of Sale Payment Processing

A database is a collection of data organised in a manner that allows access, retrieval, and use of that data.

Student Manager s Guide to the Talent Management System

DATA VALIDATION and CONDITIONAL FORMATTING

Cloud Elements ecommerce Hub Provisioning Guide API Version 2.0 BETA

Qlik REST Connector Installation and User Guide

Project Zip Code. Version CUNA s Powerful Grassroots Program. User Manual. Copyright 2012, All Rights Reserved

CORE K-Nect Web Portal

Printer Setup. What Is the Printer Setup Module?... B-2. How to Access the Printer Setup Module... B-3. Reference Information. Standard Procedures

SonicWALL GMS Custom Reports

07/04/2014 NOBIL API. Version 3.0. Skåland Webservice Side 1 / 16

Technical Support System

Instructions for Creating Silly Survey Database

Ontario Woodlot Association

Approved SCOM Health Check Report Installation Guide

ACTIVE DIRECTORY WEB SERVICE USER GUIDE LAST UPDATED: January 4, 2013

VENDOR EDI MANUAL SPORTSMAN S GUIDE (SG)

Performance Testing for Ajax Applications

Document Cycle Tracking Service User Guide

Microsoft Access 2007

Create interactive web graphics out of your SAS or R datasets

Frequently Asked Questions for the USA TODAY e-newspaper

Contents 1. Introduction Login Order Status Search for pre-advice and orders View pre-advice or order...

Manage Workflows. Workflows and Workflow Actions

All V7 registers support barcode printing, except the Sharp 410/420 1A ROM and that limitation is based upon the register.

vcloud Air Platform Programmer's Guide

MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC

Wakanda Studio Features

Strategic Information Reporting Initiative (SIRI) User Guide for Student Dashboard

Using Webmail. Technical Manual: User Guide. Document Updated: 1/07. The Webmail Window. Displaying and Hiding the Full Header.

HRS 750: UDW+ Ad Hoc Reports Training 2015 Version 1.1

B2B Quick Start Guide

Client-Side Web Programming (Part 2) Robert M. Dondero, Ph.D. Princeton University

INTRODUCING AZURE SEARCH

WebSphere Business Monitor V7.0 Script adapter lab

New Participant Digital Certificate Enrollment Procedure

Forumbee Single Sign- On

Integration Guide Version 5.3 6/25/2015

Virto Pivot View for Microsoft SharePoint Release User and Installation Guide

Unified Monitoring Portal Online Help Dashboard Designer

VENDOR SECTION An overview of the Vendor Section which is used to add, edit and send messages to vendors.

Handling of "Dynamically-Exchanged Session Parameters"

Using BlueHornet Statistics Sent Message Reporting Message Summary Section Advanced Reporting Basics Delivery Tab

Data Tool Platform SQL Development Tools

Specify the location of an HTML control stored in the application repository. See Using the XPath search method, page 2.

Outlook Mail, Calendar, Contacts, Notes & Tasks. User Guide

Title page. Alcatel-Lucent 5620 SERVICE AWARE MANAGER 13.0 R7

Application Notes: MaxCS Connector For Salesforce.com

DIRECTV Rio Track 2 Dispatch 3 rd Party QA Truck Roll Activities Instructor Guide

Quick Start Guide. 1 Copyright 2014 Samanage

MBARI Deep Sea Guide: Designing a web interface that represents information about the Monterey Bay deep-sea world.

SAS BI Dashboard 3.1. User s Guide

SQL Injection for newbie

INVENTORY MANAGEMENT. TechStorm.

QQ WebAgent Quick Start Guide

Distributor Control Center Private Label/Channel Administrators

QualysGuard WAS. Getting Started Guide Version 4.1. April 24, 2015

CRM Knowledge Base. Contents

How To Use The Web Curator Tool On A Pc Or Macbook Or Ipad (For Macbook)

Short notes on webpage programming languages

Gmail: Signatures, labels, and filters

Outlook Web Access 2003 New Features Guide

Bazaarvoice for Magento Extension Implementation Guide v6.3.4

REP200 Using Query Manager to Create Ad Hoc Queries

Context-sensitive Help Guide

Talking to Databases: SQL for Designers

Portals and Hosted Files

OnBase Client for Department Admins GEISEL FINANCE CENTER NOVEMBER 2015

ISL Online Integration Manual

Visualizing an OrientDB Graph Database with KeyLines

OFFICE OF FINANCIAL MANAGEMENT ENTERPRISE REPORTING. Financial Reports Training Manual INFORMATION SERVICES DIVISION

Visualizing a Neo4j Graph Database with KeyLines

Webmail Instruction Guide

Federal Program Office (FPO) User Manual

Transcription:

CPSC Recalls Retrieval Web Services Programmers Guide: Recalls and Penalties Database Version 1.0 March 25, 2015 Version 1.0, March 24, 2015 Page i

Table of Contents Revision History... Error! Bookmark not defined. Overview... 3 Available Recall Retrieval Search Parameters... 3 Additional Optional Recall Retrieval Search Parameters... 3 Building the Search URL... 4 Recall Retrieval Services Returned Data... 4 Example Search URLs and Resulting Data... 5 C# Example Code to Access the Recall Retrieval Web Services... 8 Example Complete Web Page to Access the Recall Retrieval Web Services... Error! Bookmark not defined. Version 1.0, March 24, 2015 Page ii

OVERVIEW This document defines the Recalls Database Web Services System Interface information for the U.S. Consumer Product Safety Commission (CPSC). The CPSC Recall Retrieval Web Services are developed as part of the CPSC Recall Database project. The services are implemented as REST web services and access recall data within a SQL Server 2012 database. As REST services they can be easily accessed in languages such as JavaScript and C#. The Recall Retrieval web services application resides on the saferproducts.gov servers and is accessed via a URL which begins with http://www.saferproducts.gov/restwebservices/recall/. This is a publicly available URL. The web services allow users to query the database by specifying various URL parameters. This document contains a description of available parameters, instructions on how to construct the URL to get the desired resulting data set and sample code for processing the resulting data set. Note: Searches by UPC can be problematic for several reasons: CPSC does not have UPCs for every product recalled and companies use and re-use UPCs differently. For these reasons, a search by UPC can lead to false positive or false negative results. Although CPSC provides a Search by UPC method, we strongly recommend using the RecallDescription or ProductName search for more complete and accurate recall information. AVAILABLE RECALL RETRIEVAL SEARCH PARAMETERS The Recall retrieval web services perform a case insensitive search for any or all of the following fields using a wildcard search. Data is returned as XML, or optionally as JSON: RecallNumber RecallDateStart RecallDateEnd LastPublishDateStart LastPublishDateEnd RecallURL RecallTitle ConsumerContact RecallDescription ProductName ProductDescription ProductModel ProductType RecallInconjunctionCountry ImageURL Injury ManufacturerCountry UPC Hazard Manufacturer Remedy Retailer Additional Optional Recall Retrieval Search Parameters The Recall retrieval web services have the following additional parameters: format: provides the output format to return the data. Possible values are XML or JSON. If not specified, the default value is XML. Version 0.1, March 25, 2015 Page 3

BUILDING THE SEARCH URL The recall web service URL has the following parts: Domain and service: http://www.saferproducts.gov/restwebservices/recall/ 0 or more parameters as noted below To instead return non-normalized bar-delimited data format the following can be used: Domain and service: http://www.saferproducts.gov/restwebservices/recalldelimited/ 0 or more parameters as noted below The default is to return the results in XML format. Adding &format=json to the URL will return the results in JSON format. RECALL RETRIEVAL SERVICES RETURNED DATA The Recall retrieval web services retrieve 1 of each of the following fields for each recall: RecallNumber RecallDate Description URL Title ConsumerContact LastPublishDate The Recall retrieval web services retrieve 0 or more of the following fields for each recall: Products: Product: Description Model Type CategoryID NumberOfUnits Inconjunctions: Images Injuries Injury Inconjunction Country Image URL Manufacturers Manufacturer Version 0.1, March 25, 2015 Page 4

CompanyID ManufacturerCountries ManufacturerCountry Country ProductUPCs ProductUPC UPC Hazards Hazard HazardTypeID Remedies Remedy Retailers Retailer CompanyID EXAMPLE SEARCH URLS AND RESULTING DATA You can view the results of the queries below by clicking the links, or entering into a browser URL. The URL to get a list of all recalls with title Child and description contains metal in XML format is: http://www.saferproducts.gov/restwebservices/recall?title=child&recalldescription=metal The URL to get the same list as above but in JSON format is: http://www.saferproducts.gov/restwebservices/recall?title=child&recalldescription=metal&f ormat=json An example of one record of the resulting data in XML format for the above query is: <Recall> <RecallID>1903</RecallID> <RecallNumber>15069</RecallNumber> <RecallDate>2015-02-04</RecallDate> <Description> The die-case metal cars may have sharp edges that pose a laceration hazard. </Description> <URL> http://www.cpsc.gov/en/recalls/2015/family-dollar-stores-recall-tough-treadz-auto- Carrier-Toy-Sets/ </URL> <Title> Family Dollar Stores Recall Tough Treadz Auto Carrier Toy Sets Due to Laceration Hazard </Title> <ConsumerContact> Version 0.1, March 25, 2015 Page 5

Family Dollar Stores at (800) 547-0359 from 8:30 a.m. to 5 p.m. Monday through Friday or online at www.familydollar.com, then click on Product Recalls in the Help section at the bottom of the page. </ConsumerContact> <LastPublishDate>2015-02-04</LastPublishDate> <Products> <Product> <Name>Tough Treadz Auto Carrier</Name> <Description> This recall involves a plastic toy truck with a plastic case that holds 6 die-cast metal toy cars in assorted colors. The truck is 14 inches long x 3 inches wide x 5 inches high. The cab of the truck comes in black, blue or red. The package is labeled as Tough Treadz Auto Carrier and has a white sticker in the upper righthand corner with $5 and SKU 1004247 printed in red. The UPC code appears on a label on the back stating Made in China. The following UPC codes are included in this recall: 678565114083, 678565114090, 678565114106. </Description> <Model/> <Type>Toy Cars</Type> <CategoryID>2188</CategoryID> <NumberOfUnits>About 254,000</NumberOfUnits> </Product> </Products> <Inconjunctions/> <Images/> <Injuries> <Injury> <Name>No reported injuries.</name> </Injury> </Injuries> <Manufacturers> <Manufacturer> <Name>Family Dollar Services</Name> <CompanyID/> </Manufacturer> </Manufacturers> <ManufacturerCountries> <ManufacturerCountry> <Country>China</Country> </ManufacturerCountry> </ManufacturerCountries> <ProductUPCs/> <Hazards> <Hazard> <Name> The die-cast metal cars can have sharp edges that pose a laceration hazard. </Name> <HazardTypeID>49</HazardTypeID> </Hazard> </Hazards> <Remedies> <Remedy> <Name> rfn-refund; Consumers should immediately stop using the recalled toy sets, take them away and return them to any Family Dollar Stores location for a full refund. </Name> </Remedy> </Remedies> <Retailers> <Retailer> <Name> Family Dollar Stores nationwide from September 2014 through December 2014 for about $5. </Name> <CompanyID/> </Retailer> </Retailers> </Recall> Version 0.1, March 25, 2015 Page 6

The same recall record in JSON format results in: ["RecallID":1903,"RecallNumber":"15069","RecallDate":"2015-02- 04T00:00:00","Description":"The die-case metal cars may have sharp edges that pose a laceration hazard.","url":"http://www.cpsc.gov/en/recalls/2015/family-dollar-stores- Recall-Tough-Treadz-Auto-Carrier-Toy-Sets/","Title":"Family Dollar Stores Recall Tough Treadz Auto Carrier Toy Sets Due to Laceration Hazard","ConsumerContact":"Family Dollar Stores at (800) 547-0359 from 8:30 a.m. to 5 p.m. Monday through Friday or online at www.familydollar.com, then click on Product Recalls in the Help section at the bottom of the page.","lastpublishdate":"2015-02-04t00:00:00","products":["name":"tough Treadz Auto Carrier","Description":"This recall involves a plastic toy truck with a plastic case that holds 6 die-cast metal toy cars in assorted colors. The truck is 14 inches long x 3 inches wide x 5 inches high. The cab of the truck comes in black, blue or red. The package is labeled as Tough Treadz Auto Carrier and has a white sticker in the upper right-hand corner with $5 and SKU 1004247 printed in red. The UPC code appears on a label on the back stating Made in China. The following UPC codes are included in this recall: 678565114083, 678565114090, 678565114106.","Model":"","Type":"Toy Cars","CategoryID":"2188","NumberOfUnits":"About 254,000"],"Inconjunctions":[],"Images":[],"Injuries":["Name":"No reported injuries."],"manufacturers":["name":"family Dollar Services","CompanyID":""],"ManufacturerCountries":["Country":"China"],"ProductUPCs":[],"Hazards":["Name":"The die-cast metal cars can have sharp edges that pose a laceration hazard.","hazardtypeid":"49"],"remedies":["name":"rfn-refund; Consumers should immediately stop using the recalled toy sets, take them away and return them to any Family Dollar Stores location for a full refund."],"retailers":["name":"family Dollar Stores nationwide from September 2014 through December 2014 for about $5.","CompanyID":""] The URL to get a list of all recalls with ProductName Toddler in XML format is: http://www.saferproducts.gov/restwebservices/recall?productname=toddler The URL to get the same list as above but in JSON format is: http://www.saferproducts.gov/restwebservices/recall?productname=toddler&format=json JAVASCRIPT EXAMPLE CODE TO ACCESS THE RECALL RETRIEVAL WEB SERVICES The code below demonstrates accessing the Recall Retrieval Web Services using JavaScript: // search recalls function SearchRecalls() // CPSCDomain var CPSCDomain = "http://www.saferproducts.gov/restwebservices"; // recalls URL var URL = CPSCDomain + "/Recall" + "?format=json"; // add filters for (var i = 0; i < fieldnames.length; i++) fieldvalue = GetFieldValue(fieldNames[i]); if (fieldvalue!= null && fieldvalue.trim()!= "") URL += "&" + fieldnames[i] + "=" + fieldvalue.trim(); // get recalls $.ajax( url: URL, type: 'GET', datatype: 'json', headers: 'Access-Control-Allow-Origin': '*', error: Version 0.1, March 25, 2015 Page 7

); function (jqxhr, textstatus, errorthrown) var whaterror = errorthrown; alert(whaterror);, success: function (data) if (data!= null) displayrecallstable(data); C# EXAMPLE CODE TO ACCESS THE RECALL RETRIEVAL WEB SERVICES The code below demonstrates accessing the Recall Retrieval Web Services using C#: using System.Net; using Newtonsoft.json; // list of recalls List<Recall> lstrecalls = null; // domain var CPSCDomain = "http://www.saferproducts.gov/restwebservices"; // set URL to recall web service with format json string URL = CPSCDomain + "/Recall" + "?format=json"; // search for RecallTitle and RecallDescription //URL += "&RecallTitle=Child"; //URL += "&RecallDescription=metal"; // search for LastPublishDate //string LastPublishDateStart = "5/29/2014"; //string LastPublishDateEnd = "5/30/2014"; //URL += "&LastPublishDateStart=" + LastPublishDateStart; //URL += "&LastPublishDateEnd=" + LastPublishDateEnd; // search for RecallNumber string RecallNumber = "15081"; URL += "&RecallNumber=" + RecallNumber; try // get recalls using (var client = new WebClient()) // headers client.headers.add("content-type", "application/json"); client.headers.add("access-control-allow-origin", "*"); client.headers.add("accept", "GET"); // invoke web service string result = client.downloadstring(url); // deserialize results lstrecalls = jsonconvert.deserializeobject<list<recall>>(result); catch (Exception ex) String strerror = ex.tostring(); Version 0.1, March 25, 2015 Page 8

The Recall and related objects are: /// Recall: /// this is the primary central table to which all others relate to on RecallID /// /// Related tables: /// Product /// Inconjunction /// Image /// Injury /// Manufacturer /// ManufacturerCountry /// ProductUPC /// Hazard /// Remedy /// Retailer public class Recall public int RecallID get; set; public string RecallNumber get; set; public DateTime? RecallDate get; set; public string Description get; set; public string URL get; set; public string Title get; set; public string ConsumerContact get; set; public DateTime? LastPublishDate get; set; public List<Product> Products get; set; public List<Inconjunction> Inconjunctions get; set; public List<Image> Images get; set; public List<Injury> Injuries get; set; public List<Manufacturer> Manufacturers get; set; public List<ManufacturerCountry> ManufacturerCountries get; set; public List<ProductUPC> ProductUPCs get; set; public List<Hazard> Hazards get; set; public List<Remedy> Remedies get; set; public List<Retailer> Retailers get; set; public class Product public string Name get; set; public string Description get; set; public string Model get; set; public string Type get; set; public int? CategoryID get; set; public string NumberOfUnits get; set; public class Inconjunction public string Country get; set; public class Image public string URL get; set; Version 0.1, March 25, 2015 Page 9

public class Injury public string Name get; set; public class Manufacturer public string Name get; set; public int? CompanyID get; set; public class ManufacturerCountry public string Country get; set; public class ProductUPC public string UPC get; set; public class Hazard public string Name get; set; public int? HazardTypeID get; set; public class Remedy public string Name get; set; public class Retailer public string Name get; set; public int? CompanyID get; set; Version 0.1, March 25, 2015 Page 10