https://github.com/node-ci/nci-rest-api-server
REST api server for nci
https://github.com/node-ci/nci-rest-api-server
Last synced: 5 months ago
JSON representation
REST api server for nci
- Host: GitHub
- URL: https://github.com/node-ci/nci-rest-api-server
- Owner: node-ci
- License: mit
- Created: 2016-01-09T14:02:48.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2021-05-15T18:46:58.000Z (over 4 years ago)
- Last Synced: 2025-08-09T11:49:30.771Z (6 months ago)
- Language: JavaScript
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# nci rest api server
REST api server for [nci](https://github.com/node-ci/nci).
## Installation
```sh
npm install nci-rest-api-server
```
## Usage
To enable add this plugin to the `plugins` section at server config:
```json
{
"plugins": [
"nci-rest-api-server"
],
"http": {
"host": "127.0.0.1",
"port": 3000,
"url": "http://127.0.0.1:3000"
},
....
}
```
after that you can access api according to your server `http.host` and
`http.port` options.
## API routes
Notes:
- Currently destructive api methods (project removing/renaming)
protected by token which could be set at config (`http.apiAccessToken` field)
or will be generated and printed to the server log during server startup.
Client should send token as `token` field at request body.
- Currently server respond format is only json.
### GET /api/0.1/builds
Get builds sorted by date in descending order.
Query parameters:
- `project` - optional project filter
- `limit` - maximum builds count to get (20 by default)
### GET /api/0.1/builds/:id
Get particular build by id.
### POST /api/0.1/builds
Create build by running given project.
Body parameters:
- `project` - project to build
- `withScmChangesOnly` - if true then build will be started only if
there is scm changes for project
- `queueQueued` - if true then currently queued project can be queued
again
### PATCH /api/0.1/builds/:id
Update build.
Body parameters:
- `cancel` - if set to true then build will be canceled
### GET /api/0.1/projects
Get configs for all currently loaded projects.
### GET /api/0.1/projects/:name
Get particular project by name.
### POST /api/0.1/projects
Create new project and set config.
Body parameters:
- `name` - project name
- `config` - project configuratjion object
- `configFile` - project config file object with `name` and `content` fields
(it's alternative for `config` option when need to set file in specific format)
- `loadConfig` - if true then project will be loaded
### PATCH /api/0.1/projects/:name
Modify project.
To rename project, body parameters:
- `name` - new project name
To set project config, body parameters:
- `config` - project configuratjion object
- `configFile` - project cconfig file object with `name` and `content` fields
(it's alternative for `config` option when need to set file in specific format)
- `loadConfig` - if true then project will be loaded
To archive/unarchive project, body parameters:
- `archived` - boolean, new state of the project
### DELETE /api/0.1/projects/:name
Remove project.