Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json Mandrill Curl请求返回无效密钥错误_Json_Api_Post_Curl_Mandrill - Fatal编程技术网

Json Mandrill Curl请求返回无效密钥错误

Json Mandrill Curl请求返回无效密钥错误,json,api,post,curl,mandrill,Json,Api,Post,Curl,Mandrill,我试图通过Mandrill API发送电子邮件,但它在我提供的密钥中抛出了一个错误。下面是我在curl请求中包含的text.json文件 { 'key' : 'MyActualKey', 'message': { 'html': '<p>Example HTML content</p>', 'text': 'Example text content', 'subject': 'example subject', 'from_email':

我试图通过Mandrill API发送电子邮件,但它在我提供的密钥中抛出了一个错误。下面是我在curl请求中包含的
text.json
文件

{
'key' : 'MyActualKey',
'message': {
    'html': '<p>Example HTML content</p>',
    'text': 'Example text content',
    'subject': 'example subject',
    'from_email': 'from@example.com',
    'from_name': 'Test',
    'to': [
        {
            'email': 'to@example.com',
            'name': 'Eric Clapton',
            'type': 'to'
        }
    ],
    'headers': {
        'Reply-To': 'reply@example.com'
    },
    'merge': True,
    'tags': [
        'Mandrill Test'
    ]
 },
'ip_pool': 'Main Pool'
}

请注意最后一行如何显示“指定键值”-同样,这是来自Mandrill控制面板的精确键。我甚至还生成了几个,但都失败了。

尝试将其更改为有效的json,看看这是否有帮助:

  • 将所有单引号更改为双引号
  • 将“merge”的值从“True”更改为小写的“True”

  • 他也有类似的问题。它不喜欢单引号的类型(我猜是vs撇号?)
    * Adding handle: conn: 0x7fd922803a00
    * Adding handle: send: 0
    * Adding handle: recv: 0
    * Curl_addHandleToPipeline: length: 1
    * - Conn 0 (0x7fd922803a00) send_pipe: 1, recv_pipe: 0
    * About to connect() to mandrillapp.com port 443 (#0)
    *   Trying 54.221.22.61...
    * Connected to mandrillapp.com (54.221.22.61) port 443 (#0)
    * TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
    * Server certificate: mandrillapp.com
    * Server certificate: Thawte SSL CA
    * Server certificate: thawte Primary Root CA
    * Server certificate: Thawte Premium Server CA
    > POST /api/1.0/messages/send.json HTTP/1.1
    > User-Agent: curl/7.30.0
    > Host: mandrillapp.com
    > Accept: */*
    > Content-Type: application/json
    > Content-Length: 501
    >
    * upload completely sent off: 501 out of 501 bytes
    < HTTP/1.1 500 Internal Server Error
    * Server nginx/1.6.0 is not blacklisted
    < Server: nginx/1.6.0
    < Date: Sat, 14 Jun 2014 23:46:44 GMT
    < Content-Type: application/json; charset=utf-8
    < Transfer-Encoding: chunked
    < Connection: keep-alive
    < X-Powered-By: PHP/5.3.10-1ubuntu3.11
    < Access-Control-Allow-Origin: *
    < Access-Control-Allow-Methods: POST, GET, OPTIONS
    < Access-Control-Allow-Headers: Content-Type
    < Access-Control-Allow-Credentials: false
    <
    * Connection #0 to host mandrillapp.com left intact
    {"status":"error","code":-1,"name":"ValidationError","message":"You must specify a key value"}