简体   繁体   English

尝试创建Webhook的错误400/401

[英]Error 400/401 trying to create a webhook

I am brand new to webhooks and have had a nightmare trying to get my first one to function. 我是Webhooks的新手,经历了一场噩梦,试图让我的第一个开始工作。 I am trying to use a Particle Photon to send a single float temperature variable to a site that can graph the data. 我正在尝试使用粒子光子将单个浮点温度变量发送到可以绘制数据图表的站点。 I've tried creating webhooks to thingspeak.com and librato.com with no success. 我尝试创建对Thingspeak.com和librato.com的Webhooks,但没有成功。 My main attempts have been trying to use the json code in tutorials to create the webhook. 我的主要尝试是尝试使用教程中的json代码创建Webhook。

Here is my Photon's code: 这是我的光子代码:

#include "Particle.h"

float temp = 70.1000;
float adjust = 0.4;
int acOn = 0;

void setup()
{

}

void loop()
{
    if(temp < 72) 
    adjust = random(1620000)/1000000.0;

    else if(temp < 74)
    adjust = random(1000000)/1000000.0;

    else
    adjust = -1*random(500000,2200000)/1000000.0;

    temp = temp + adjust;

    Particle.publish("librato_", String(temp), 60, PRIVATE);
    Particle.process();
    delay(30000);
}

and the webhook JSON code (for the librato attempt) 和webhook JSON代码(用于librato尝试)

{
    "event": "librato_",
    "url": "https://metrics-api.librato.com/v1/metrics",
    "requestType": "POST",
    "auth": {
        "username": "YOUR_LIBRATO_USERNAME",
        "password": "YOUR_LIBRATO_API_TOKEN"
    },
    "json": {
        "gauges": [
            {
                "name": "{{NAME}}",
                "value": "{{temp}}",
                "source": "{{PARTICLE_DEVICE_ID (particle API token?)}}"
            }
        ]
    },
    "mydevices": true
}

where I have filled in the username and API token found on librato and also the particle api token in the IDE settings. 我已在librato中填写了用户名和API令牌,并在IDE设置中填充了粒子api令牌。 Thanks in advance for the help. 先谢谢您的帮助。

Looks like this user had a similar problem which was solved with a simple renaming or the webhook: https://community.particle.io/t/connection-to-librato-solved/19230 看起来这个用户有一个类似的问题,可以通过简单的重命名或网络挂钩来解决: https ://community.particle.io/t/connection-to-librato-solved/19230

Check with the Particle CLI if any events are being generated. 使用粒子CLI检查是否正在生成任何事件。 If you are still not seeing data in Librato, reach out to support@librato.com so that we can check the API for errors. 如果您仍然没有在Librato中看到数据,请联系support@librato.com,以便我们检查API是否存在错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM