Computer Related > Using REST APIs Miscellaneous
Thread Author: smokie Replies: 13

 Using REST APIs - smokie
Having spent a small amount of time with this today it actually seems quite easy, if only I could get the syntax right. I installed HTTPIE and it's pre-reqs which took a while, but I can't find out how to actually fire up HTTPIE. So I tried by using their example in a CURL command (in a command window), which must have come with something I've installed over the years.

I just piped the output to a text file and I had some viable data. Except I need to format it better to allow for a straightforward import, but that is, I presume, stage 2.

I couldn't get it to accept any parameters though, like a from and to date. And apparently, according to SWMBO, I had more important things to do, like getting on with the decorating I am in the middle of.

I'm away for the weekend but will find a bit of time for this next week I hope.

This was the CURL command
curl -u "sk_live_[[my metering info]]:" api.octopus.energy/v1/electricity-meter-points/[[my metering info]]/meters/18P5046815/consumption/ > d:d.txt

which gave some output from the past three days but I when tried adding the parameters they mention after a , without a and other combos but it then couldn't find the host. Like this

curl -u "sk_live_[[my metering info]]:" api.octopus.energy/v1/electricity-meter-points/[[my metering info]]/meters/18P5046815/consumption/ period_from=="2018-12-25T00:00" period_to=="2018-12-26T00:00" > d:c.txt

Possibly I am mixing command types or something.

The output came as one long coma separated string which I managed to get into Excel (easily!) but I could do with making it suitable to easily alter to a table after importing it. I could probably have done that with a macro but I'm trying to keep it simple.
 Messages Author Date
 Using REST APIs new smokie 10 Jan 19 08:57
 Using REST APIs new Kevin 10 Jan 19 20:32
 Using REST APIs new smokie 11 Jan 19 09:16
 Using REST APIs new Kevin 11 Jan 19 23:27
 Using REST APIs new smokie 12 Jan 19 00:32
 Using REST APIs new smokie 12 Jan 19 09:03
 Using REST APIs new Kevin 12 Jan 19 22:34
 Using REST APIs new smokie 13 Jan 19 18:57
 Using REST APIs new Kevin 13 Jan 19 20:51
 Using REST APIs new Kevin 18 Jan 19 23:21
 Using REST APIs new smokie 19 Jan 19 08:11
 Using REST APIs new Kevin 19 Jan 19 23:11
 Using REST APIs new smokie 19 Jan 19 23:46
 Using REST APIs new smokie 8 Feb 19 08:15
Latest Forum Posts