{"id":19370180,"url":"https://github.com/phonegap/node-phonegap-build-api","last_synced_at":"2025-04-23T15:31:59.095Z","repository":{"id":5269538,"uuid":"6448114","full_name":"phonegap/node-phonegap-build-api","owner":"phonegap","description":"Node.js REST Client for the PhoneGap Build API","archived":false,"fork":false,"pushed_at":"2018-09-17T18:17:13.000Z","size":125,"stargazers_count":62,"open_issues_count":6,"forks_count":27,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-02T17:11:15.532Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"mendable/liquidizer","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phonegap.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-10-29T21:41:56.000Z","updated_at":"2022-12-09T12:09:15.000Z","dependencies_parsed_at":"2022-09-02T10:50:50.722Z","dependency_job_id":null,"html_url":"https://github.com/phonegap/node-phonegap-build-api","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phonegap%2Fnode-phonegap-build-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phonegap%2Fnode-phonegap-build-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phonegap%2Fnode-phonegap-build-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phonegap%2Fnode-phonegap-build-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phonegap","download_url":"https://codeload.github.com/phonegap/node-phonegap-build-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250460538,"owners_count":21434260,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T08:14:32.558Z","updated_at":"2025-04-23T15:31:58.788Z","avatar_url":"https://github.com/phonegap.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PhoneGap Build API Node Module [![Build Status][travis-ci-img]][travis-ci-url] [![bitHound Score][bithound-img]][bithound-url]\n\n\u003e Node.js REST Client for the PhoneGap Build API\n\n## Overview\n\nThis library simplifies authentication and requests to the\n[PhoneGap Build REST API][build-api-docs] for node.js clients.\n\nIn many ways, this library is little more than a convenience wrapper\nfor [mikeal's][github-mikeal] [request][github-request] library. You can expect\nthat all of [request's][github-request] functionality to be available to the\n`API` object returned by `client.auth();`.\n\nIf something is inaccurate or missing, please send a pull request!\n\n## Usage\n\n### Authenticate with Username and Password\n\n    var client = require('phonegap-build-api');\n\n    client.auth({ username: 'zelda', password: 'tr1f0rce' }, function(e, api) {\n        // time to make requests\n    });\n\n### Authenticate with Token\n\n    var client = require('phonegap-build-api');\n\n    client.auth({ token: 'abc123' }, function(e, api) {\n        // time to make requests\n    });\n\n### GET /api/v1/me\n\n    api.get('/me', function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### GET /api/v1/apps\n\n    api.get('/apps', function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### GET /api/v1/apps/:id\n\n    api.get('/apps/199692', function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### GET /api/v1/apps/:id/icon\n\n    api.get('/apps/199692/icon').pipe(fs.createWriteStream('icon.png'));\n\n### GET /api/v1/apps/:id/:platform\n\n    api.get('/apps/199692/android').pipe(fs.createWriteStream('app.apk'));\n\n### GET /api/v1/keys\n\n    api.get('/keys', function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### GET /api/v1/keys/:platform\n\n    api.get('/keys/ios', function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### GET /api/v1/keys/:platform/:id\n\n    api.get('/keys/ios/917', function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### POST /api/v1/apps\n\n    var options = {\n        form: {\n            data: {\n                title: 'My App',\n                create_method: 'file'\n            },\n            file: '/path/to/app.zip'\n        }\n    };\n\n    api.post('/apps', options, function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### PUT /api/v1/apps/:id\n\n    var options = {\n        form: {\n            data: {\n                debug: false\n            },\n            file: '/path/to/app.zip'\n        }\n    };\n\n    api.put('/apps/197196', options, function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### POST /api/v1/apps/:id/icon\n\n    var options = {\n        form: {\n            icon: 'my-icon.png'\n        }\n    };\n\n    api.post('/apps/232741/icon', options, function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### POST /api/v1/apps/:id/build\n\nBuild all platforms:\n\n    api.post('/apps/232741/build', function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\nBuild specific platforms:\n\n    var options = {\n        form: {\n            data: {\n                platforms: [ 'android', 'blackberry', 'ios', 'winphone', 'webos' ]\n            }\n        }\n    };\n\n    api.post('/apps/232741/build', options, function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### POST /api/v1/apps/:id/build/:platform\n\n    api.post('/apps/232741/build/android', function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### POST /api/v1/apps/:id/collaborators\n\n    var options = {\n        form: {\n            data: {\n                email: 'michael@michaelbrooks.ca',\n                role: 'dev'\n            }\n        }\n    };\n\n    api.post('/apps/232741/collaborators', options, function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### PUT /api/v1/apps/:id/collaborators/:id\n\n    var options = {\n        form: {\n            data: {\n                role: 'tester'\n            }\n        }\n    };\n\n    api.put('/apps/232741/collaborators/263955', options, function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### POST /api/v1/keys/:platform\n\n    var options = {\n        form: {\n            data: {\n                title: 'My BlackBerry Signing Key',\n                password: 'my-password'\n            },\n            db: '/path/to/sigtool.db',\n            csk: '/path/to/sigtool.csk'\n        }\n    };\n\n    api.post('/keys/blackberry', options, function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### PUT /api/v1/keys/:platform/:id\n\n    var options = {\n        form: {\n            data: {\n                password: 'my-updated-password'\n            }\n        }\n    };\n\n    api.put('/keys/blackberry/1505', options, function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### DELETE /api/v1/apps/:id\n\n    api.del('/apps/14450', function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### DELETE /api/v1/apps/:id/collaborators/:id\n\n    api.del('/apps/232741/collaborators/263955', function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### DELETE /api/v1/keys/:platform/:id\n\n    api.del('/keys/ios/2729', function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n## API\n\n### client.auth(options, callback)\n\nPhoneGap Build Authentication.\n\nAuthentications with PhoneGap Build and returns an instance of `API`.\nThe authentication credentials can be a username and password or user-token.\n\n#### Options:\n\n  - `options` `{Object}` is the authentication settings.\n  - `options.username` `{String}` is the phonegap build username.\n  - `options.password` `{String}` is the phonegap build password.\n  - `options.token` `{String}` can be used instead of username and password.\n  - [`options.protocol`] `{String}` optional server protocol. e.g. 'https:'.\n  - [`options.host`] `{String}` optional server host. e.g. 'build.phonegap.com:'.\n  - [`options.port`] `{String}` optional server port. e.g. '443'.\n  - [`options.path`] `{String}` optional server path prefix. e.g. '/api/v1'.\n  - [`options.proxy`] `{String}` specifies an optional proxy server. e.g. 'http://myproxy.com:8181'.\n  - `callback` `{Function}` is trigger after the authentication.\n    - `e` `{Error}` is null unless there is an error.\n    - `api` `{Object}` is the `API` instance to interact with phonegap build.\n\n#### Example:\n\n    var client = require('phonegap-build-api');\n\n    client.auth({ username: 'zelda', password: 'tr1force' }, function(e, api) {\n        if (e) {\n            console.log('error:', e);\n            return;\n        }\n\n        // make some api requests\n    });\n\n### api(path, [options], [callback])\n\nAPI Request.\n\nCreate a RESTful request to the PhoneGap Build API. The `api` function is a\nwrapper to [request][github-request]'s interface.\n\nThe `path` parameter is a relative path to a PhoneGap Build API response.\nFor example, to the resource `https://build.phonegap.com/api/v1/me` is specified\nas the path `/me`.\n\nThe `options` parameter maps directly to [request][github-request]'s options.\n\nThe default request method is `GET`. You can specify a specific but you can be changed\nin the `options` parameters (e.g. `{ method: 'POST' }`).\n\nTo send form data, you can use the `options.form` parameter. The key `data` is\nassumed to be JSON and all other keys are assumed to be file paths.\n\n#### Options:\n\n  - `path` `{String}` is a relative resource path (e.g. `\"/apps\"`).\n  - `[options]` `{Object}` is a request options object.\n  - `[options.protocol]` `{String}` optional server protocol. e.g. 'https:'.\n  - `[options.host]` `{String}` optional server host. e.g. 'build.phonegap.com:'.\n  - `[options.port]` `{String}` optional server port. e.g. '443'.\n  - `[options.path]` `{String}` optional server path prefix. e.g. '/api/v1'.\n  - `[callback]` `{Function}` is trigger after the request\n    - `e` `{Error}` is null unless there is an error\n    - `data` `{Object}` is the JSON response.\n\n#### Example: GET Request\n\n    api('/me', function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n#### Example: POST Request\n\n    var options = {\n        form: {\n            data: {\n                title: 'My App',\n                create_method: 'file'\n            },\n            file: '/path/to/app.zip'\n        },\n        method: 'POST'\n    };\n\n    api('/apps', options, function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### api.get(path, [options], [callback])\n\nGET API Request.\n\nA convenience function for `api(path, [options], [callback])`, where `options`\nuses `{ method: 'GET' }`.\n\n#### Options:\n\n  - `path` `{String}` is a relative resource path (e.g. `\"/apps\"`).\n  - `[options]` `{Object}` is a request options object.\n  - `[callback]` `{Function}` is trigger after the request\n    - `e` `{Error}` is null unless there is an error\n    - `data` `{Object}` is the JSON response.\n\n#### Example:\n\n    api.get('/me', function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### api.post(path, [options], [callback])\n\nPOST API Request.\n\nA convenience function for `api(path, [options], [callback])`, where `options`\nuses `{ method: 'POST' }`.\n\n#### Options:\n\n  - `path` `{String}` is a relative resource path (e.g. `\"/apps\"`).\n  - `[options]` `{Object}` is a request options object.\n  - `[callback]` `{Function}` is trigger after the request\n    - `e` `{Error}` is null unless there is an error\n    - `data` `{Object}` is the JSON response.\n\n#### Example:\n\n    var options = {\n        form: {\n            data: {\n                title: 'My App',\n                create_method: 'file'\n            },\n            file: '/path/to/app.zip'\n        }\n    };\n\n    api.post('/apps', options, function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### api.put(path, [options], [callback])\n\nPUT API Request.\n\nA convenience function for `api(path, [options], [callback])`, where `options`\nuses `{ method: 'PUT' }`.\n\n#### Options:\n\n  - `path` `{String}` is a relative resource path (e.g. `\"/apps\"`).\n  - `[options]` `{Object}` is a request options object.\n  - `[callback]` `{Function}` is trigger after the request\n    - `e` `{Error}` is null unless there is an error\n    - `data` `{Object}` is the JSON response.\n\n#### Example:\n\n    var options = {\n        form: {\n            data: {\n                debug: false\n            },\n            file: '/path/to/app.zip'\n        }\n    };\n\n    api.put('/apps/197196', options, function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### api.del(path, [options], [callback])\n\nDELETE API Request.\n\nA convenience function for `api(path, [options], [callback])`, where `options`\nuses `{ method: 'DELETE' }`.\n\n#### Options:\n\n  - `path` `{String}` is a relative resource path (e.g. `\"/apps\"`).\n  - `[options]` `{Object}` is a request options object.\n  - `[callback]` `{Function}` is trigger after the request\n    - `e` `{Error}` is null unless there is an error\n    - `data` `{Object}` is the JSON response.\n\n#### Example:\n\n    api.del('/apps/14450', function(e, data) {\n        console.log('error:', e);\n        console.log('data:', data);\n    });\n\n### api.defaults(options)\n\nThis maps directly to [request][github-request]'s `default` method.\n\n\u003e This method returns a wrapper around the normal request API that defaults to whatever options you pass in to it.\n\n## Alternative Libraries\n\n### Java\n\n- [pgbuild-api][pgbuild-api] by [Hardeep Shoker][github-hardeep]\n\n### Node.js\n\n- [phonegapbuildapi][github-phonegapbuildapi] by [germallon][github-germallon]\n\n[travis-ci-img]: https://travis-ci.org/phonegap/node-phonegap-build-api.svg?branch=master\n[travis-ci-url]: https://travis-ci.org/phonegap/node-phonegap-build-api\n[build-api-docs]: https://build.phonegap.com/docs/api\n[github-mikeal]: https://github.com/mikeal\n[github-request]: https://github.com/mikeal/request\n[pgbuild-api]: https://github.com/hardeep/pgbuild-api\n[github-hardeep]: https://github.com/hardeep\n[github-phonegapbuildapi]: https://github.com/germallon/phonegapbuildapi\n[github-germallon]: https://github.com/germallon\n[bithound-img]: https://www.bithound.io/github/phonegap/node-phonegap-build-api/badges/score.svg\n[bithound-url]: https://www.bithound.io/github/phonegap/node-phonegap-build-api\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphonegap%2Fnode-phonegap-build-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphonegap%2Fnode-phonegap-build-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphonegap%2Fnode-phonegap-build-api/lists"}