GithubHelp home page GithubHelp logo

bestbuy / api-playground Goto Github PK

View Code? Open in Web Editor NEW
259.0 16.0 102.0 13.68 MB

The Best Buy API Playground is an API training tool for students, educators and other learners to explore the possibilities of a fully functional RESTful API in a simple, non-production environment.

License: Other

CSS 4.34% JavaScript 95.45% HTML 0.20% Dockerfile 0.01%

api-playground's Introduction

Best Buy API Playground

travis Coverage Status semistandard

What the API Playground Is

The Best Buy API Playground is an API training tool for students, educators and other learners to explore the possibilities of a fully functional RESTful API in a simple, non-production environment. API Playground was developed by Best Buy and makes use of a Creative Commons licensed dataset including over 50,000 products and store-related information - making it easy for teaching APIs (both consumption and creation) to classrooms with realistic data. The playground supports full CRUD (Create Read Update Delete) operations for all API endpoints and does not require any external services nor databases.

Please note: This system is for educational and training purposes only. It behaves differently than Best Buy's actual API, uses an older version of our catalog, and does not represent any real-world data.

API Playground makes use of solid API standards and best practices. It is designed to allow you to learn about an API framework in a local environment. Beyond being a fully functional API, it also includes several top-notch API tools such as the Feathers Framework, Mocha test framework, Swagger and Postman.

What the API Playground Isn't

API Playground does not give users access to usable data from BestBuy.com or any production Best Buy APIs. For information on accessing Best Buy's complete API suite, check out https://developer.bestbuy.com/. API Playground isn't designed to be used in production environments, although many of its building blocks are production grade.

API Playground does not represent any guarantees of patterns or design principles used at Best Buy.

Getting Started

Make sure you have NodeJS installed (we require version 4 or newer).

git clone https://github.com/bestbuy/api-playground/
cd api-playground
npm install
npm start
# Best Buy API Playground started at http://localhost:3030

Now open http://localhost:3030 in your browser to begin exploring the API. From there we'll guide you on using tools such as Swagger and Postman to get meaningful experience interacting with APIs.

Configuration Options

Configuration settings are managed using Feathers Configuration. The options that you may want to adjust, depending on your usage, are:

  • port - HTTP port where the API is listening. Defaults to 3030.
  • readonly - If true, database cannot be modified (i.e. create, update, patch & remove operations are disabled). Defaults to false.

Things That Power the Playground

Beyond all the great libraries (which are mentioned within the package.json, such as Sequelize), here are some of the crucial components and resources that made assembling with API Playground possible:

Feathers

This project uses Feathers, an open source web framework for building modern real-time applications. Feathers does the majority of the heavy lifting within the application. It is an amazing framework that we highly recommend and enjoy using.

Swagger

Swagger is a wonderful way to describe APIs, and coupled with Swagger UI creates a great way to interact with them. It offers a nice sanity check that basically boils down to, "If you can't describe it in Swagger, it probably isn't a RESTful API."

Postman

Writing an API is only half the challenge, and consuming it is the other half. Within API Playground we include a Postman Collection that helps developers learn how to interact with the API Playground for all CRUD operations and a couple interesting API operations. Another great aspect of Postman is the generate code functionality, which leads to repeatable cURL commands as well as usable code in most popular languages.

GeoNames

GeoNames has been around since 2002 and provides many useful datasets to help people make meaningful products. Particularly relevant to API Playground is their postal code service, which enables this API to do semi-accurate location searching.

18F API Standards

The work of defining an API is difficult, and creating consistency within an organization is a large challenge. We really appreciate the work that the 18F has done to help set standards. In addition to the 18F, Microsoft also has a great set of API guidelines. Both of these sets are recommended readings for anyone creating or contributing to API development.

Testing

Run npm test and all the tests in the test/ directory will be executed. Our test suite uses a combination of the Mocha JavaScript test framework and semistandard to ensure code quality and consistency.

Help

If you have questions, encounter a bug or would like to submit a new feature, please open an issue on GitHub.

Credit

This application has been provided by Best Buy's API team. If your company has a web or mobile application that talks about consumer electronics, please consider signing up for an API key and integrating us into your application.

Licenses

Copyright (c) 2016

api-playground's People

Contributors

azakordonets avatar brandeseric avatar ecaron avatar flet avatar gengle avatar seanmwalker avatar snahor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api-playground's Issues

New Issue

I have tried many things but still........
Pleas go through these images

Screenshot (339)
Screenshot (340)

Post npm start getting this error

C:\Users\Rishi.Awasthi\bestbuy\api-playground>npm start

[email protected] start
node src/

node:internal/modules/cjs/loader:936
throw err;
^

Error: Cannot find module 'feathers'
Require stack:

  • C:\Users\Rishi.Awasthi\bestbuy\api-playground\src\app.js
  • C:\Users\Rishi.Awasthi\bestbuy\api-playground\src\index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object. (C:\Users\Rishi.Awasthi\bestbuy\api-playground\src\app.js:4:21)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    'C:\Users\Rishi.Awasthi\bestbuy\api-playground\src\app.js',
    'C:\Users\Rishi.Awasthi\bestbuy\api-playground\src\index.js'
    ]
    }

POST'ing an array of categories, products,... is not supported.

Often it is quite handy to post an array of categories in one request instead of eg. 5 seperate requests.
This valdiation prevents this: https://github.com/BestBuy/api-playground/blob/master/src/hooks/validate-schema.js#L17-L26

This is possible in a standard feathers app:

const players = _map(this.players, player => {
              return {
                name: player.name,
                teamId: team.id
              }
            })
            http.post('/players', players)
              .then((result) => {
                this.$router.push({name: 'play', params: {teamId: team.id}})
              })

Post executing "npm install" iam getting the below error, node version is 14.15.4. npm version 6.14.10

[email protected] install /Users//Documents/BestBuyAPIs/api-playground/node_modules/sqlite3
node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v83-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v83 ABI, unknown) (falling back to source compile with node-gyp)
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users//Documents/BestBuyAPIs/api-playground/node_modules/sqlite3/lib/binding/node-v83-darwin-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/Users//Documents/BestBuyAPIs/api-playground/node_modules/sqlite3/lib/binding/node-v83-darwin-x64" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"
gyp ERR! cwd /Users//Documents/BestBuyAPIs/api-playground/node_modules/sqlite3
gyp ERR! node -v v14.15.4
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users//Documents/BestBuyAPIs/api-playground/node_modules/sqlite3/lib/binding/node-v83-darwin-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users//Documents/BestBuyAPIs/api-playground/node_modules/sqlite3/lib/binding/node-v83-darwin-x64 --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
node-pre-gyp ERR! stack at ChildProcess. (/Users//Documents/BestBuyAPIs/api-playground/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:315:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1048:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
node-pre-gyp ERR! System Darwin 19.6.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users//Documents/BestBuyAPIs/api-playground/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users//Documents/BestBuyAPIs/api-playground/node_modules/sqlite3
node-pre-gyp ERR! node -v v14.15.4
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users//Documents/BestBuyAPIs/api-playground/node_modules/sqlite3/lib/binding/node-v83-darwin-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users//Documents/BestBuyAPIs/api-playground/node_modules/sqlite3/lib/binding/node-v83-darwin-x64 --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

Issue in npm Start

When i try to start application with npm start command it shows error as
"Error: Cannot find module 'feathers'
Require stack:

  • G:\api automatio learning\api-playground\src\app.js
  • G:\api automatio learning\api-playground\src\index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object. (G:\api automatio learning\api-playground\src\app.js:4:21)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    'G:\api automatio learning\api-playground\src\app.js',
    'G:\api automatio learning\api-playground\src\index.js'
    ]
    }
    "

Response Body is showing only 10 records eventhouth there are more than that availbale in the sql query.

Here In response body we can clearly see that there are total 87 no. of records and we can see only 10 records out of it, How can I see rest 77 records?

Get Request : http://localhost:3030/products/?name[$like]=*star+wars*&price[$lt]=30&$select=name&$select=price

Response body:
{
"total": 87,
"limit": 10,
"skip": 0,
"data": [
{
"name": "LEGO Star Wars: The Complete Saga - PRE-OWNED - Nintendo DS",
"price": 9.99
},
{
"name": "Star Wars The Clone Wars: Republic Heroes - PRE-OWNED - Nintendo DS",
"price": 9.99
},
{
"name": "Star Wars Battlefront: Elite Squadron - PRE-OWNED - Nintendo DS",
"price": 9.99
},
{
"name": "LEGO Star Wars III: The Clone Wars - Xbox 360",
"price": 19.99
},
{
"name": "Star Wars: The Force Unleashed II โ€” PRE-OWNED - Nintendo Wii",
"price": 9.99
},
{
"name": "Star Wars: The Force Unleashed II - PRE-OWNED - PlayStation 3",
"price": 9.99
},
{
"name": "Star Wars: The Force Unleashed II - PRE-OWNED - Nintendo DS",
"price": 9.99
},
{
"name": "EA - Star Wars: The Old Republic 2400 Cartel Coins Card for Windows",
"price": 19.99
},
{
"name": "LEGO Star Wars III: The Clone Wars - PRE-OWNED - Xbox 360",
"price": 9.99
},
{
"name": "LEGO Star Wars III: The Clone Wars - PRE-OWNED - Nintendo 3DS",
"price": 9.99
}
]
}

New error - sequelize.import is not a function while npm start

Getting Below error while performing npn start

D:\BestBuyAPI\api-playground>npm start

[email protected] start
node src/

D:\BestBuyAPI\api-playground\src\db\index.js:36
var model = sequelize['import'](path.join(__dirname, file));
^

TypeError: sequelize.import is not a function
at D:\BestBuyAPI\api-playground\src\db\index.js:36:38
at Array.forEach ()
at Function.setupDatabase (D:\BestBuyAPI\api-playground\src\db\index.js:35:6)
at Function.configure (D:\BestBuyAPI\api-playground\node_modules\feathers\lib\application.js:150:8)
at Function.module.exports (D:\BestBuyAPI\api-playground\src\services\index.js:11:7)
at Function.configure (D:\BestBuyAPI\api-playground\node_modules\feathers\lib\application.js:150:8)
at Object. (D:\BestBuyAPI\api-playground\src\app.js:31:4)
at Module._compile (node:internal/modules/cjs/loader:1109:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32)

Not able to clone.

I just paste the command in git bash cmd but project did not clone in directory.
No error and exception occurred refer the attached screenshot
BestBuyApit_CMD

add a version endpoint

It would be nice to have an endpoint that shows what version of api-playground is running.

Performing npm install gives me the below error.Please help!

npm install
npm WARN deprecated [email protected]: request has been deprecated, see request/request#3142
npm WARN deprecated [email protected]: Feathers v3 is out and this module has moved to @feathersjs/configuration. See https://docs.feathersjs.com/migrating.html for more information.
npm WARN deprecated [email protected]: Feathers v3 is out and has moved to @feathersjs/feathers. See https://docs.feathersjs.com/migrating.html for more information.
npm WARN deprecated [email protected]: Feathers v3 is out and has moved to @feathersjs/errors. See https://docs.feathersjs.com/migrating.html for more information.
npm WARN deprecated [email protected]: Feathers v3 is out and this module is now part of @feathersjs/express. See https://docs.feathersjs.com/migrating.html for more information.
npm WARN deprecated [email protected]: Feathers v3 is out and this module has been integrated into Feathers core. See https://docs.feathersjs.com/migrating.html for more information.
npm WARN deprecated [email protected]: Feathers v3 is out and this module has moved to @feathersjs/socketio and @feathersjs/socketio-client. See https://docs.feathersjs.com/migrating.html for more information.
npm WARN deprecated [email protected]: Upgrade feathers-sequelize to version 6.1.0 or later for important usability and security improvements. See https://crow.docs.feathersjs.com/guides/migrating.html#database-adapters for more information. An upgrade to Feathers 4 is recommended but not required.
npm WARN deprecated [email protected]: request has been deprecated, see request/request#3142
npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated [email protected]: This version will no longer receive security fixes per our security policy. Please update to sequelize@5 or above.
npm WARN deprecated [email protected]: No longer maintained, please upgrade to swagger-ui@3.
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: to-iso-string has been deprecated, use @segment/to-iso-string instead.
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated [email protected]: This module is no longer maintained. Use https://github.com/feathersjs/hooks instead.
npm WARN deprecated [email protected]: Feathers v3 is out and this module has moved to @feathersjs/commons. See https://docs.feathersjs.com/migrating.html for more information.
npm WARN deprecated [email protected]: This module has been integrated into @feathersjs/commons.
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated [email protected]: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: Please use the native JSON object instead of JSON 3
npm WARN deprecated [email protected]: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm ERR! Unexpected end of JSON input while parsing near '...y":"^2.1.0"},"dist":{'

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\sudhe\AppData\Roaming\npm-cache_logs\2020-12-18T05_21_48_068Z-debug.log

Add switch to make API read only

We may want to add a switch to make run the API in a read only mode (no create/update/delete). Perhaps read only should be the default?

This could be accomplished via an env var.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.