2017-01-17 4 views
1

を「私たちは、不特定のJSONパースエラーが発生しました」を返しますはカール使用してMailChimpリストにユーザーを購読することは、常に私は、私はMailChimpリストに加入者を追加する必要が</p> <p>と呼ばれるバッチファイルを作成するアプリケーションを持っている

curl.exe -v --request POST --url "https://us11.api.mailchimp.com/3.0/lists/list_id/members" --user "anystring:api_key" --header "content-type: application/json" --data "{"email_address":"[email protected]", "status":"subscribed"}" --include 

私は提案通りに依頼を更新しましたが、まだエラーです。はい、二重引用符が問題であるように見えます。

{"type":"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"JSON Parse Error","status":400,"detail":"We encountered an unspecified JSON parsing error.","instance":""} 

Note: Unnecessary use of -X or --request, POST is already inferred. 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
           Dload Upload Total Spent Left Speed 
    0  0 0  0 0  0  0  0 --:--:-- --:--:-- --:--:--  0* Trying 92.123.199.167... 
* Connected to us11.api.mailchimp.com (92.123.199.167) port 443 (#0) 
* ALPN, offering h2 
* ALPN, offering http/1.1 
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH 
* successfully set certificate verify locations: 
* CAfile: C:\DevPB\Epos\ca-bundle.crt 
    CApath: none 
* TLSv1.2 (OUT), TLS header, Certificate Status (22): 
} [5 bytes data] 
* TLSv1.2 (OUT), TLS handshake, Client hello (1): 
} [512 bytes data] 
* TLSv1.2 (IN), TLS handshake, Server hello (2): 
{ [104 bytes data] 
* TLSv1.2 (IN), TLS handshake, Certificate (11): 
{ [2662 bytes data] 
* TLSv1.2 (IN), TLS handshake, Server key exchange (12): 
{ [333 bytes data] 
* TLSv1.2 (IN), TLS handshake, Server finished (14): 
{ [4 bytes data] 
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16): 
} [70 bytes data] 
* TLSv1.2 (OUT), TLS change cipher, Client hello (1): 
} [1 bytes data] 
* TLSv1.2 (OUT), TLS handshake, Finished (20): 
} [16 bytes data] 
* TLSv1.2 (IN), TLS change cipher, Client hello (1): 
{ [1 bytes data] 
* TLSv1.2 (IN), TLS handshake, Finished (20): 
{ [16 bytes data] 
* SSL connection using TLSv1.2/ECDHE-RSA-AES256-GCM-SHA384 
* ALPN, server accepted to use http/1.1 
* Server certificate: 
* subject: C=US; ST=Georgia; L=Atlanta; O=The Rocket Science Group, LLC; OU=IT; CN=*.api.mailchimp.com 
* start date: May 3 00:00:00 2016 GMT 
* expire date: May 3 23:59:59 2017 GMT 
* subjectAltName: host "us11.api.mailchimp.com" matched cert's "*.api.mailchimp.com" 
* issuer: C=US; O=GeoTrust Inc.; CN=GeoTrust SSL CA - G3 
* SSL certificate verify ok. 
* Server auth using Basic with user 'anystring' 
} [5 bytes data] 
> POST /3.0/lists/XXXXXXXX/members HTTP/1.1 
> Host: us11.api.mailchimp.com 
> Authorization: Basic XXXXXXXXXXXXXXXXXXXXX 
> User-Agent: curl/7.50.1 
> Accept: */* 
> content-type: application/json 
> Content-Length: 69 
> 
} [69 bytes data] 
* upload completely sent off: 69 out of 69 bytes 
{ [5 bytes data] 
< HTTP/1.1 400 Bad Request 
< Server: openresty 
< Content-Type: application/problem+json; charset=utf-8 
< Content-Length: 203 
< X-Request-Id: 145d8a92-f4c5-4a83-8e1f-f72cf7850c45 
< Link: <https://us11.api.mailchimp.com/schema/3.0/ProblemDetailDocument.json>; rel="describedBy" 
< Date: Wed, 18 Jan 2017 13:42:59 GMT 
< Connection: close 
< Set-Cookie: _AVESTA_ENVIRONMENT=prod; path=/ 
< 
{ [203 bytes data] 
100 272 100 203 100 69 419 142 --:--:-- --:--:-- --:--:-- 419 
* Closing connection 0 
} [5 bytes data] 
* TLSv1.2 (OUT), TLS alert, Client hello (1): 
} [2 bytes data] 

C:\DevPB\Epos> 

答えて

1

シングルクォートをサポートしていないWindows端末によって発生する可能性があります。データを二重引用符で置き換えます。例

--data "{\"email_address\"...}" 

にもデバッグ出力上に-vスイッチを使ってコマンドを実行してみてください。そして、それがうまくいかない場合、あなたの質問を出力で更新してください。

+0

ありがとうございました問題を整理しました –

+0

上記の作品とメールが購読されていますが、私はなぜ出力がHTTP/1.1 400 Bad Requestを表示しているのだろうと思っていました。 –

+0

*完全にオフに送らアップロード:71 71のうちバイトを

関連する問題