Skip to content

Latest commit

 

History

History
431 lines (331 loc) · 6.57 KB

example.md

File metadata and controls

431 lines (331 loc) · 6.57 KB

Wobble

This is our high-quality wobbles API. You can use this API to request and remove different wobbles at a low wibble price.

List wobbles

Lists all wobbles for a particular account.

GET /wobbles/v1/{username} wobbles:read

Example request

$ curl https://wobble.biz/wobbles/v1/{username}
$ wbl wobbles list
client.listWobbles(function(err, wobbles) {
  console.log(wobbles);
});
wobbles.list()

Example response

[
  {
    "owner": "{username}",
    "id": "{wobble_id}",
    "created": "{timestamp}",
    "modified": "{timestamp}"
  },
  {
    "owner": "{username}",
    "id": "{wobble_id}",
    "created": "{timestamp}",
    "modified": "{timestamp}"
  }
]

Create wobble

Creates a new, empty wobble.

POST /wobbles/v1/{username}

Example request

curl -X POST https://wobble.biz/wobbles/v1/{username}
$ wbl wobbles create
client.createWobble({
  name: 'example',
  description: 'An example wobble'
}, function(err, wobble) {
  console.log(wobble);
});
response = wobbles.create(
  name='example', description='An example wobble')

Example request body

{
  "name": "foo",
  "description": "bar"
}
Property Description
name (optional) the name of the wobble
description (optional) a description of the wobble

Example response

{
  "owner": "{username}",
  "id": "{wobble_id}",
  "name": null,
  "description": null,
  "created": "{timestamp}",
  "modified": "{timestamp}"
}

Retrieve a wobble

Returns a single wobble.

GET /wobbles/v1/{username}/{wobble_id}

Retrieve information about an existing wobble.

Example request

curl https://wobble.biz/wobbles/v1/{username}/{wobble_id}
$ wbl wobble read-wobble wobble-id
attrs = wobbles.read_wobble(wobble_id).json()
client.readWobble('wobble-id',
  function(err, wobble) {
    console.log(wobble);
  });

Example response

{
  "owner": "{username}",
  "id": "{wobble_id}",
  "created": "{timestamp}",
  "modified": "{timestamp}"
}

Update a wobble

Updates the properties of a particular wobble.

PATCH /wobbles/v1/{username}/{wobble_id}

Example request

curl --request PATCH https://wobble.biz/wobbles/v1/{username}/{wobble_id} \
  -d @data.json
resp = wobbles.update_wobble(
  wobble_id,
  name='updated example',
  description='An updated example wobble'
  ).json()
$ wbl wobble update-wobble wobble-id
var options = { name: 'foo' };
client.updateWobble('wobble-id', options, function(err, wobble) {
  console.log(wobble);
});

Example request body

{
  "name": "foo",
  "description": "bar"
}
Property Description
name (optional) the name of the wobble
description (optional) a description of the wobble

Example response

{
  "owner": "{username}",
  "id": "{wobble_id}",
  "name": "foo",
  "description": "bar",
  "created": "{timestamp}",
  "modified": "{timestamp}"
}

Delete a wobble

Deletes a wobble, including all wibbles it contains.

DELETE /wobbles/v1/{username}/{wobble_id}

Example request

curl -X DELETE https://wobble.biz/wobbles/v1/{username}/{wobble_id}
$ wbl wobble delete-wobble wobble-id
resp = wobbles.delete_wobble(wobble_id)
client.deleteWobble('wobble-id', function(err) {
  if (!err) console.log('deleted!');
});

Example response

HTTP 204

List wibbles

List all the wibbles in a wobble. The response body will be a WobbleCollection.

GET /wobbles/v1/{username}/{wobble_id}/wibbles

Example request

curl https://wobble.biz/wobbles/v1/{username}/{wobble_id}/wibbles
$ wbl wobble list-wibbles wobble-id
collection = wobbles.list_wibbles(wobble_id).json()
client.listWobbles('wobble-id', {}, function(err, collection) {
  console.log(collection);
});

Example response

{
  "type": "Wobble",
  "wibbles": [
    {
      "id": "{wibble_id}",
      "type": "Wobble",
      "properties": {
        "prop0": "value0"
      }
    },
    {
      "id": "{wibble_id}",
      "type": "Wobble",
      "properties": {
        "prop0": "value0"
      }
    }
  ]
}

Insert or update a wibble

Inserts or updates a wibble in a wobble. If there's already a wibble with the given ID in the wobble, it will be replaced. If there isn't a wibble with that ID, a new wibble is created.

PUT /wobbles/v1/{username}/{wobble_id}/wibbles/{wibble_id}

Example request

curl https://wobble.biz/wobbles/v1/{username}/{wobble_id}/wibbles/{wibble_id} \
  -X PUT \
  -d @file.geojson
$ wbl wobble put-wibble wobble-id wibble-id 'geojson-wibble'
var wibble = {
  "type": "Wobble",
  "properties": { "name": "Null Island" }
};
client.insertWobble(wibble, 'wobble-id', function(err, wibble) {
  console.log(wibble);
});

Example request body

{
  "id": "{wibble_id}",
  "type": "Wobble",
  "properties": {
    "prop0": "value0"
  }
}
Property Description
id the id of an existing wibble in the wobble

Example response

{
  "id": "{wibble_id}",
  "type": "Wobble",
  "properties": {
    "prop0": "value0"
  }
}

Retrieve a wibble

Retrieves a wibble in a wobble.

GET /wobbles/v1/{username}/{wobble_id}/wibbles/{wibble_id}

Example request

curl https://wobble.biz/wobbles/v1/{username}/{wobble_id}/wibbles/{wibble_id}
$ wbl wobble read-wibble wobble-id wibble-id
client.readWobble('wibble-id', 'wobble-id',
  function(err, wibble) {
    console.log(wibble);
  });
wibble = wobbles.read_wibble(wobble_id, '2').json()

Example response

{
  "id": "{wibble_id}",
  "type": "Wobble",
  "properties": {
    "prop0": "value0"
  }
}

Delete a wibble

Removes a wibble from a wobble.

DELETE /wobbles/v1/{username}/{wobble_id}/wibbles/{wibble_id}

Example request

client.deleteWobble('wibble-id', 'wobble-id', function(err, wibble) {
  if (!err) console.log('deleted!');
});
curl -X DELETE https://wobble.biz/wobbles/v1/{username}/{wobble_id}/wibbles/{wibble_id}
resp = wobbles.delete_wibble(wobble_id, wibble_id)
$ wbl wobble delete-wibble wobble-id wibble-id

Example response

HTTP 204