API Collections plugin for the Screwdriver API
const Hapi = require('@hapi/hapi');
const server = new Hapi.Server();
const collectionsPlugin = require('./');
server.connection({ port: 3000 });
server.register({
register: collectionsPlugin,
options: {}
}, () => {
server.start((err) => {
if (err) {
throw err;
}
console.log('Server running at:', server.info.uri);
});
});GET /collections
GET /collections/{id}
POST /collections
Arguments
name- Name of the collection. Names must be unique.description- An optional description of the collection.pipelineIds- An optional array of ids of pipelines to be added to the collection.
Example payload:
{
"name": "Screwdriver",
"description": "Collection for screwdriver related pipelines",
"pipelineIds": [12, 35, 47, 89]
}You can update the name, description, or pipelineIds of a collection.
PUT /collections/{id}
Arguments
name- An optional new name for the collection. Names must be unique.description- An optional new description for the collection.pipelineIds- An optional new array of ids of pipelines for the collection.
Example payload:
{
"name": "foo",
"description": "bar",
"pipelineIds": [1, 2, 5]
}PUT /collections/{id}/pipelines?ids[]={pipelineId}
Examples:
PUT /collections/123/pipelines?ids[]=11&ids[]=23 adds pipelines with id equal to 11 and 23 to the collection with id equal to 123
DELETE /collections/{id}/pipelines?ids[]={pipelineId}
Examples:
DELETE /collections/123/pipelines?ids[]=11&ids[]=23 removes pipelines with id equal to 11 and 23 from the collection with id equal to 123
DELETE /collections/123/pipelines removes all the pipelines from the collection with id equal to 123
DELETE /collections/{id}