api help beginner

My first time working with npn/api. I follow instructions listed here https://github.com/gameflip/gfapi
and i am tuck at installing.
After typing npm install it shows

C:\Users\filli\Desktop\gfapi-master>npm install

dtrace-provider@0.8.6 install C:\Users\filli\Desktop\gfapi-master\node_modules\dtrace-provider
node-gyp rebuild || node suppress-error.js

C:\Users\filli\Desktop\gfapi-master\node_modules\dtrace-provider>if not defined npm_config_node_gyp (node “C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\…\node_modules\node-gyp\bin\node-gyp.js” rebuild ) else (node “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can’t find Python executable “python”, you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” “rebuild”
gyp ERR! cwd C:\Users\filli\Desktop\gfapi-master\node_modules\dtrace-provider
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
added 89 packages in 6.477s

then after npm run-script docs

C:\Users\filli\Desktop\gfapi-master>npm run-script docs

gfapi@0.1.1 docs C:\Users\filli\Desktop\gfapi-master
jsdoc -c jsdoc_conf.js -d docs -P package.json index.js; docco -o docs/samples src/samples/.js src/samples/.rb

Unknown command-line option “o”.

JSDoc 3.5.5 (Thu, 14 Sep 2017 02:51:54 GMT)

-a, --access Only display symbols with the given access: “package”, public", “protected”,
“private” or “undefined”, or “all” for all access levels. Default: all except
-c, --configure The path to the configuration file. Default: path/to/jsdoc/conf.json
-d, --destination The path to the output folder. Default: ./out/
–debug Log information for debugging JSDoc.
-e, --encoding Assume this encoding when reading all source files. Default: utf8
-h, --help Print this message and quit.
–match When running tests, only use specs whose names contain .
–nocolor When running tests, do not use color in console output.
-p, --private Display symbols marked with the @private tag. Equivalent to “–access all”.
Default: false
-P, --package The path to the project’s package file. Default: path/to/sourcefiles/package.json
–pedantic Treat errors as fatal errors, and treat warnings as errors. Default: false
-q, --query A query string to parse and store in jsdoc.env.opts.query. Example:
-r, --recurse Recurse into subdirectories when scanning for source files and tutorials.
-R, --readme The path to the project’s README file. Default: path/to/sourcefiles/README.md
-t, --template The path to the template to use. Default: path/to/jsdoc/templates/default
-T, --test Run all tests and quit.
-u, --tutorials Directory in which JSDoc should search for tutorials.
-v, --version Display the version number and quit.
–verbose Log detailed information to the console as JSDoc runs.
-X, --explain Dump all found doclet internals to console and quit.

Visit http://usejsdoc.org for more information.
There are no input files to process.
npm ERR! errno 1
npm ERR! gfapi@0.1.1 docs: jsdoc -c jsdoc_conf.js -d docs -P package.json index.js; docco -o docs/samples src/samples/.js src/samples/.rb
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gfapi@0.1.1 docs 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:
npm ERR! C:\Users\filli\AppData\Roaming\npm-cache_logs\2018-04-17T15_02_50_360Z-debug.log


According to the error message, you need to install Python (2.7) and maybe also set its PATH so the program knows where to find it.

For example, install Python to
then on the command line enter:
set PYTHON=C:\Python\bin\Python.exe
(or wherever that file is)

Then try the npm install command again. And npm run-script docs should work after that.

ok i will try

ok i installed python but still doesn’t work

You didn’t do anything wrong. The problem is at npm run-script docs, which runs the command:

jsdoc -c jsdoc_conf.js -d docs -P package.json index.js; docco -o docs/samples src/samples/.js src/samples/.rb

The semicolon “;” is used to separate commands in UNIX, but when you run it on Windows it’s interpreted as a separation of parameters. To fix this, open the gfapi-master\package.json file with a text editor and change the semicolon to " &". Additionally, you have to change the “/” to “\” because on Windows a path is like “C:\Program Files\Stuff” while on UNIX it’s “/Applications/Stuff”. Finally, save the file then run npm run-script docs again.

The result (line 24) in that package.json file would be:

"docs": "jsdoc -c jsdoc_conf.js -d docs -P package.json index.js & docco -o docs\samples src\samples\*.js src\samples\*.rb"

Please reply with the error printout again if that does not work.

i changed and now i see another error

C:\Users\Samsung\Desktop\gfapi-master>npm install
npm ERR! file C:\Users\Samsung\Desktop\gfapi-master\package.json
npm ERR! Failed to parse json
npm ERR! Unexpected token s in JSON at position 665 while parsing near ‘…js &
docco -o docs\samples src\samples…’
npm ERR! File: C:\Users\Samsung\Desktop\gfapi-master\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Samsung\AppData\Roaming\npm-cache_logs\2018-04-24T15_30_1


changed file

“name”: “gfapi”,
“version”: “0.1.1”,
“description”: “Gameflip API”,
“keywords”: “Gameflip”,
“homepage”: “https://github.com/iJJi/gfapi”,
“bugs”: “https://github.com/iJJi/gfapi/issues”,
“author”: {
“name”: “Eng-Shien Wu”,
“email”: "engshien.wu@ijji.com"
“license”: “MIT”,
“private”: true,
“files”: [
“repository”: “iJJi/gfapi”,
“engines”: {
“node”: “>=8.5.0”
“scripts”: {
“bulk_listing”: “node src/samples/bulk_listing.js”,
“test”: “ENVIRONMENT=mocha mocha src/test --recursive”,
“docs”: “jsdoc -c jsdoc_conf.js -d docs -P package.json index.js & docco -o docs\samples src\samples*.js src\samples*.rb”
“dependencies”: {
“bunyan”: “^1.8.12”,
“bluebird”: “^3.5.0”,
“node-rest-client-promise”: “^3.0.0”,
“request”: “^2.85.0”,
“request-promise”: “^4.2.2”,
“http-errors”: “^1.6.2”,
“promise-ratelimit”: “^0.0.3”,
“speakeasy”: “^2.0.0”,
“base-64”: “^0.1.0”
“devDependencies”: {
“mocha”: “^3.2.0”,
“chai”: “^3.5.0”,
“marked”: “^0.3.19”,
“docco”: “^0.7.0”,
“jsdoc”: “^3.5.5”

Sorry, I forgot to escape the backslashes because it’s JSON format, it should be “\\” instead of “\”. So line 24 should be:

"docs": "jsdoc -c jsdoc_conf.js -d docs -P package.json index.js & docco -o docs\\samples src\\samples\\*.js src\\samples\\*.rb"

On Step 4 “Run Sample Code”, the Windows equivalent should be:
node src\samples\FILENAME_OF_SAMPLE_CODE_HERE.js

So if you want to run the search listings example, enter the two “SET” lines to store your credentials, then:
node src\samples\search_listing.js
to run that file (which you can edit).

Thank you for help i will try this solution tomorrow.

i changed *.js to authorization.js and node src\samples\search_listing.js works Thanks for help galacticarm

One more problem with listings. I run sample code rl_listing.js it creates listing but without type: Key. I added

tags: ‘Type: Key’

that listing creatred by api looks the same as created manually but site’s filter doesn’t include listing’s tag created by api.
10$ listing is created manually 100.50$ using api when i filter by type: key site doesn’t show listings created by api. 2018-04-25_20h09_33

If you want to add tags, they have to be strings in an array, examples:

tags: ['id: key', 'type: Key'],

tags: ['id: pearlescent_matte', 'type: Paint finish'],

tags: ['id: jager_619_rs', 'type: Body', 'certification: Show Off'],

The tags are for users to search for your listing when they use the dropdown filters.

1 Like

now everything work fine thank you

Hey one more problem typing

GET /api/v1/account/me/profile HTTP/1.1
Host: production-gameflip.fingershock.com
Authorization: GFAPI 8d6(…):5o0(…)

and i am getlling this

“status”: “FAILURE”,
“data”: null,
“error”: {
“message”: “Unauthorized”,
“code”: 401

Never mind. I found bug in sample code. In index.js in line 325 it should be additional field with display order because without it photo is set only as cover photo and it looks like

additional field

path: ‘/photo/’ + photo_obj.id + ‘/display_order’,
Value: 1


For the profile, save this snippet as a file into: gfapi/src/samples/get_profile.js then run the file the same way you did the others.

'use strict';

const GFAPI_KEY = process.env.GFAPI_KEY;
const GFAPI_SECRET = process.env.GFAPI_SECRET;
const GfApi = require('../../index'); // require('gfapi')

async function main() {
    const gfapi = new GfApi(GFAPI_KEY, {
        secret: GFAPI_SECRET,
        algorithm: "SHA1",
        digits: 6,
        period: 30
    }, {
        logLevel: 'debug'

    let profile = await gfapi.profile_get();

main().catch(err => {
    console.log('==== ERROR', err);

The display_order operation is indeed required (and missing), so please do use that to create your listing.

1 Like