The official blog for Numerous. Life's most important numbers available at a glance.

Getting Started with the Numerous REST API

Charlie Wood
25 August 2014

This post is intended as a short, simple guide intended to help you get started using the Numerous REST API using cURL.

1. Find Your API Key

In the Numerous app, tap menu > Settings > Developer Info.

2. Create a new metric

In the app, tap the “+” tile. For this example, we'll create a metric called “Sam’s Balance”

3. Get the new metric's ID

From a command line (don’t forget the colon after your API key!):

curl -u {apiKey}: https://api.numerousapp.com/v1/users/me/metrics

You should get output that looks like this:

[
    {
        "id": "4707354896543463485",
        "ownerId": "718",
        "updated": "2014-07-02T11:56:54.110Z",
        "label": "Hudson's Balance",
        "description": "Hudson's allowance account balance",
        "photoURL": "https://api.numerousapp.com/v1/metrics/4707354896543463485/photo",
        "kind": "currency",
        "value": 27.3055,
        "units": "",
        "unit": "",
        "private": true,
        "writeable": true,
        "subscriberCount": 1,
        "currencySymbol": "$",
        "links": {
            "self": "https://api.numerousapp.com/metrics/4707354896543463485",
            "web": "http://n.numerousapp.com/m/zrkajs7inrnh"
        }
    },
    {
        "id": "37803412356902024",
        "ownerId": "718",
        "updated": "2014-08-30T15:30:28.162Z",
        "label": "Sam's Balance",
        "description": "Sam's allowance account balance",
        "photoURL": "https://api.numerousapp.com/v1/metrics/37803412356902024/photo",
        "kind": "currency",
        "value": 0,
        "units": "",
        "unit": "",
        "private": true,
        "writeable": true,
        "subscriberCount": 1,
        "links": {
            "self": "https://api.numerousapp.com/metrics/37803412356902024",
            "web": "http://n.numerousapp.com/m/aclaksjk10o"
        }
    },
    ...
]

We can see that the metric with the label “Sam’s Balance” was created with an id of "37803412356902024".

4. Update the metric with a new value.

You do this not by updating the Metric itself, but by creating a new Event for it. Again from a command line, do this:

curl -u {apiKey}: https://api.numerousapp.com/v1/metrics/37803412356902024/events -d '{"value": 99.99}'

and you should get a response something like this:

{
    "id": "4189887676545784498",
    "metricId": "37803412356902024",
    "authorId": "81726615231635221",
    "updated": "2014-08-30T14:07:43.250Z",
    "value": 99.99
}

5. Success!

If you look at the number in the app, you’ll see that it’s been updated with the new value.

Of course there’s a lot more you can do with the Numerous REST API so I encourage you to browse through the documentation. In a future post I’ll show how to do this and more using PHP.

comments powered by Disqus