Create and manage your swarms.
http://api.bugswarm.net/swarms
"x-bugswarmapikey: ${API_KEY}"
,"content-type: application/json"
Create a swarm by passing a JSON object representing the swarm to create. After creation, you may add resources to the swarm. Additionally, users may specify any of their own resources to add to the swarm by default upon creation. This is configured in the JSON object that gets passed.
{ "name": "My Other Swarm", "description": "My Other Swarm Description", "public": false, "resources": [ { "resource_id": "33e675f7888c1d7f6f5da41bcccdff7b67f6c9a0", "resource_type": "consumer" } ] }Usage: Create a JSON file with the name
create_swarm.json
and matching the above
format. Then execute:
curl -X POST -d@create_swarm.json --header "x-bugswarmapikey: 911cbc244827dba9c6dbdd09aff3e5e8fe5eee02" --header "content-type: application/json" http://api.bugswarm.net/swarmsReturns: The created swarm and its configuration as a JSON object. The "resources" field will exist as an empty array if no resources are given upon creation.
{ "id": "92236421f64633430baa54fd9848e03aa2696111", "user_id": "username", "description": "My Other Swarm description", "name": "My Other Swarm" "created_at": "2011-08-29T20:17:08.676Z", "resources": [ { "resource_id": "33e675f7888c1d7f6f5da41bcccdff7b67f6c9a0", "resource_type": "consumer", "user_id": "username", "url": "http://api.bugswarm.net/resources/33e675f7888c1d7f6f5da41bcccdff7b67f6c9a0" } ], "public": false }
http://api.bugswarm.net/swarms/SWARM_ID
"x-bugswarmapikey: ${API_KEY}"
,"content-type: application/json"
Update a swarm by passing a JSON object containing the fields that the you wish to update.
{ "name": "My Other Swarm updated", "description": "My Other Swarm description updated", "public": true }Usage: Create a JSON file with the name
update_swarm.json
and matching the above
format. Then execute:
curl -X PUT -d@update_swarm.json --header "x-bugswarmapikey: 911cbc244827dba9c6dbdd09aff3e5e8fe5eee02" --header "content-type: application/json" http://api.bugswarm.net/swarms/SWARM_IDReturns: The updated swarm as a JSON object, including a "modified_at" field.
{ "description": "My Other Swarm description updated", "modified_at": "2011-10-10T01:08:54.688Z", "id": "92236421f64633430baa54fd9848e03aa2696111", "name": "My Other Swarm" "user_id": "username", "created_at": "2011-08-29T20:17:08.676Z", "resources": [ { "resource_id": "33e675f7888c1d7f6f5da41bcccdff7b67f6c9a0", "resource_type": "consumer", "swarm_id": "92236421f64633430baa54fd9848e03aa2696111", "user_id": "username", "url": "http://api.bugswarm.net/resources/33e675f7888c1d7f6f5da41bcccdff7b67f6c9a0", "member_since": "2011-10-10T01:01:55.184Z" } ], "public": true }
http://api.bugswarm.net/swarms/SWARM_ID
"x-bugswarmapikey:
${API_KEY}"
Destroy a swarm. Destroying a swarm removes it completely from the user account. The method uses the unique swarm id specified in the URL to determine which swarm to destroy.
curl -X DELETE --header "x-bugswarmapikey: 911cbc244827dba9c6dbdd09aff3e5e8fe5eee02" http://api.bugswarm.net/swarms/SWARM_IDReturns: HTTP Response Codes
http://api.bugswarm.net/swarms
"x-bugswarmapikey: ${API_KEY}"
List all of the swarms owned by the user. Each listed swarm will also contain the resources that are a member of that swarm.
curl -X GET --header "x-bugswarmapikey: 911cbc244827dba9c6dbdd09aff3e5e8fe5eee02" http://api.bugswarm.net/swarmsReturns: A list of swarms as a JSON array.
[ { "id": "a16fb1d896817c58d4f4be9dea51e74b86519579", "user_id": "username", "description": "My Swarm description", "name": "My Swarm", "created_at": "2011-08-29T20:17:08.676Z", "resources": [ { "resource_id": "33e675f7888c1d7f6f5da41bcccdff7b67f6c9a0", "resource_type": "producer", "user_id": "username", "url": "http://api.bugswarm.net/resources/33e675f7888c1d7f6f5da41bcccdff7b67f6c9a0", "member_since": "2011-10-10T01:01:55.184Z" }, { "resource_id": "4735f4417f4fd2eb67ace9f2d2e7948e2d9f43f9", "resource_type": "both", "user_id": "username", "url": "http://api.bugswarm.net/resources/4735f4417f4fd2eb67ace9f2d2e7948e2d9f43f9", "member_since": "2011-10-10T01:01:55.184Z" } ], "public": true }, { "id": "92236421f64633430baa54fd9848e03aa2696111", "user_id": "username", "description": "My Other Swarm description", "name": "My Other Swarm", "created_at": "2011-08-29T20:17:08.676Z", "resources": [ { "resource_id": "33e675f7888c1d7f6f5da41bcccdff7b67f6c9a0", "resource_type": "consumer", "user_id": "username", "url": "http://api.bugswarm.net/resources/33e675f7888c1d7f6f5da41bcccdff7b67f6c9a0", "member_since": "2011-10-10T01:01:55.184Z" } ], "public": false } ]
http://api.bugswarm.net/swarms/SWARM_ID
"x-bugswarmapikey: ${API_KEY}"
This method retrieves the information for a given swarm. The id of the swarm to retrieve the information from is given in the URL.
curl -X GET --header "x-bugswarmapikey: 911cbc244827dba9c6dbdd09aff3e5e8fe5eee02" http://api.bugswarm.net/swarms/SWARM_IDReturns: A swarm as a JSON object.
{ "description": "My Other Swarm description", "id": "92236421f64633430baa54fd9848e03aa2696111", "modified_at": "2011-10-10T01:08:54.688Z", "name": "My Other Swarm" "user_id": "username", "created_at": "2011-08-29T20:17:08.676Z", "resources": [ { "resource_id": "33e675f7888c1d7f6f5da41bcccdff7b67f6c9a0", "resource_type": "consumer", "user_id": "username", "url": "http://api.bugswarm.net/resources/33e675f7888c1d7f6f5da41bcccdff7b67f6c9a0", "member_since": "2011-10-10T01:01:55.184Z" } ], "public": true }
http://api.bugswarm.net/swarms/SWARM_ID/resources
"x-bugswarmapikey: ${API_KEY}"
"content-type: application/json"
Each swarm is owned by a given user and can be configured to contain resources. Swarms can contain the resources of many members. This method adds a resource to a given swarm. The method passes a JSON file containing the swarm-relevant information regarding the resource to add. The "type" field passed in the JSON refers to whether the resource will act as a producer or a consumer. This method can only be used to add your resources to a swarm that you own. To add another member's resource(s) to your swarm or to join another member's swarm with your resources, please see the invitations section of the API documentation.
{ "resource_id": "33e675f7888c1d7f6f5da41bcccdff7b67f6c9a0", "resource_type": "consumer" }Usage: Create a JSON file with the name
add_resource.json
and matching the above
format. Then execute:
curl -X POST -d@add_resource.json --header "x-bugswarmapikey: 911cbc244827dba9c6dbdd09aff3e5e8fe5eee02" --header "content-type: application/json" http://api.bugswarm.net/swarms/SWARM_ID/resourcesReturns: HTTP Response Codes
http://api.bugswarm.net/swarms/SWARM_ID/resources
"x-bugswarmapikey: ${API_KEY}",
"content-type: application/json"
Each swarm is owned by a given user and can be configured to contain resources. Swarms can contain the resources of many members. This method removes a resource from a given swarm. The method passes a JSON file containing the information regarding the resource to remove. Removing a resource from a swarm does not remove it from the user account. To perform this action, use the Destroy method for user resources.
{ "resource_id": "33e675f7888c1d7f6f5da41bcccdff7b67f6c9a0", "resource_type": "consumer" }Usage: Create a JSON file with the name
remove_resource.json
and matching the above
format. Then execute:
curl -X DELETE -d@remove_resource.json --header "x-bugswarmapikey: 911cbc244827dba9c6dbdd09aff3e5e8fe5eee02" --header "content-type: application/json" http://api.bugswarm.net/swarms/SWARM_ID/resourcesReturns: HTTP Response Codes
http://api.bugswarm.net/swarms/SWARM_ID/resources
"x-bugswarmapikey: ${API_KEY}"
Users may list the resources that are members of a given swarm. The list will print each resource and its swarm-relevant information in JSON format.
curl -X GET --header "x-bugswarmapikey: 911cbc244827dba9c6dbdd09aff3e5e8fe5eee02" http://api.bugswarm.net/swarms/SWARM_ID/resources curl -X GET --header "x-bugswarmapikey: 911cbc244827dba9c6dbdd09aff3e5e8fe5eee02" http://api.bugswarm.net/swarms/SWARM_ID/resources?type=producer curl -X GET --header "x-bugswarmapikey: 911cbc244827dba9c6dbdd09aff3e5e8fe5eee02" http://api.bugswarm.net/swarms/SWARM_ID/resources?type=consumerReturns: A list of resources as as JSON array.
[ { "resource_id": "33e675f7888c1d7f6f5da41bcccdff7b67f6c9a0", "resource_type": "producer", "swarm_id": "a16fb1d896817c58d4f4be9dea51e74b86519579", "user_id": "username", "url": "http://api.dev.bugswarm.net/resources/33e675f7888c1d7f6f5da41bcccdff7b67f6c9a0", "member_since": "2011-10-10T01:01:55.184Z" }, { "resource_id": "4735f4417f4fd2eb67ace9f2d2e7948e2d9f43f9", "resource_type": "consumer", "swarm_id": "a16fb1d896817c58d4f4be9dea51e74b86519579", "user_id": "username", "url": "http://api.dev.bugswarm.net/resources/4735f4417f4fd2eb67ace9f2d2e7948e2d9f43f9", "member_since": "2011-10-10T02:13:08.537Z" } ]