everydayhero: Developer

Metadata

The metadata service allows keys to be specified for object types, and values to be specified for specific objects of that type.

There is no traditional authentication required for this service, instead we scope the data under the token you provide.

List all Keys

GET https://mds.everydayhero.io/api/v1/keys

Parameters

type : required string
The object type (Page, Campaign, etc).

token : required string
Scope for the data required.

Example

https://mds.everydayhero.io/api/v1/keys?type=Page&token=30e466c3-ffae-413a-a5cc-59563d16605d

Response

{
  "keys": [
    {
      "id": 1,
      "name": "test key",
      "description": "test test",
      "object_type": "Page"
    }
  ]
}

Create a key

POST https://mds.everydayhero.io/api/v1/keys

Parameters

token : required string
Scope for the data specified.

key : required string
The key you would like to add for this type.

type : required string
The object type (Page, Campaign, etc).

description : required string
Describe what values for this key should represent.

Example

{
  "token": "30e466c3-ffae-413a-a5cc-59563d16605d",
  "key": "constituent_id",
  "type": "Page",
  "description": "foo bar"
}

Response

204 No Content for Success

404 Not Found for Invalid Key

Update a key

PUT https://mds.everydayhero.io/api/v1/keys/:id

Parameters

token : required string
Scope for the data specified.

id : required integer
ID of the key you would like to update.

key : required string
The new key name.

description : required string
The new key description.

Example

{
  "token": "30e466c3-ffae-413a-a5cc-59563d16605d",
  "id": "30",
  "key": "constituent_id",
  "description": "foo bar"
}

Response

204 No Content for Success

404 Not Found for Invalid Key

Destroy a key

DELETE https://mds.everydayhero.io/api/v1/keys/:id

Parameters

token : required string
Scope for the data specified.

id : required integer
ID of the key to destroy.

Example

https://mds.everydayhero.io/api/v1/keys/30?token=30e466c3-ffae-413a-a5cc-59563d16605d

Response

204 No Content for Success

403 Forbidden for Invalid Token

Show stats for a key

GET http://mds.everydayhero.io/api/v1/keys/:id/stats

Parameters

token : required string
Scope for the data required.

id : required integer
ID of the key you would like stats for.

Example

http://mds.everydayhero.io/api/v1/keys/30/stats?token=30e466c3-ffae-413a-a5cc-59563d16605d

Response

{
  "count": 10
}

List all metadata

GET https://mds.everydayhero.io/api/v1/metadata

Parameters

token : required string
Scope for the data required.

type : required string
The object type (Page, Campaign, etc).

ids : required string
IDs of the objects of the specified type you would like metadata for.

Example

https://mds.everydayhero.io/api/v1/metadata?token=30e466c3-ffae-413a-a5cc-59563d16605d&type=Page&ids=1,2,3,5,8

Response

{
  "metadata": [
    {
      "type": "Page",
      "id": 1,
      "labels": {
        "constituent_id": 3,
        "donor_id": 5
      }
    }
  ]
}

Create metadata

POST https://mds.everydayhero.io/api/v1/metadata

Parameters

token : required string
Scope for the data specified.

type : required string
The object type (Page, Campaign, etc).

id : required integer
ID of the object of this type you would like to set a value for.

key : required string
The key you would like to set a value for.

value : required string
The value for this key.

Example

{
  "token": "30e466c3-ffae-413a-a5cc-59563d16605d",
  "type": "Page",
  "id": "1",
  "key": "constituent_id",
  "value": "foo"
}

Response

204 No Content for Success

404 Not Found for Invalid Key