LoginSignup
1
2

More than 5 years have passed since last update.

cloudBit の subscriptions API に curl を使って登録する方法

Last updated at Posted at 2016-04-20

TL;DR

もう少し詳細に言うと、subscriptions APIpublisher_events パラメータ付きで登録する方法です。
以下のように json データを送ると、登録することができます。

$ curl -i -XPOST -H "Authorization: Bearer TOKEN" \
    -H "Content-Type: application/json" \
    -H "Accept: application/vnd.littlebits.v2+json" \
    https://api-http.littlebitscloud.cc/subscriptions \
    --data '{"subscriber_id":"https://your.api.server", "publisher_id":"555555555555", "publisher_events":["amplitude"]}'

publisher_events パラメータ付きで登録しようとしたら、エラーになって登録できない

公式や他の記事を参考に以下のようにして登録しようとしても、500 エラーで登録することができませんでした(2016/04/20 現在)。

$ curl -i -XPOST -H "Authorization: Bearer TOKEN" \
    -H "Accept: application/vnd.littlebits.v2+json" \
    https://api-http.littlebitscloud.cc/subscriptions \
    -d subscriber_id=https://your.api.server \
    -d publisher_id= 555555555555 \
    -d publisher_events="['amplitude']"

HTTP/1.1 500 Internal Server Error

問い合わせをしたところ、API のアップデートに伴って json を受け付けるようになったようです(詳しくは聞いていないですが)。
なのでもしエラーで登録できない方がいれば、参考にしてみてください。

Resources

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2