我做了一个简单的请求,在我的linkedin个人资料上分享一些内容 我尝试用curl做它,但它不起作用
我在标题中将内容类型设置为JSON,我还在标题
中设置了授权curl -v -H 'Authorization: OAuth oauth_consumer_key="V9uKPtEEB7JxQvYzbR2DuDfLe4qXjASgP5UhPJp8k13CYgSnN3BRFILxUJ6ApuCH",oauth_token="d6af5cda-b46e-4c38-b566-11428a9584fc",oauth_signature_method="HMAC-SHA1",oauth_signature="1PofnBExFc7pMB8b08fV34B5sTg%3D",oauth_timestamp="1323544645",oauth_nonce="516e0a1eadda4c24bfbcc4ca5e0cbedc",oauth_version="1.0"' -H 'Content-Type: application/json' -X POST -d '{"recipients":{"values": [{"person":{"_path": "/people/~"}}]}, "subject": "JSON POST test", "body": "You rule"}' http://api.linkedin.com/v1/people/~/shares
当我发布这个时,我得到了这个结果
About to connect() to api.linkedin.com port 80 (#0)
* Trying 216.52.242.83... connected
* Connected to api.linkedin.com (216.52.242.83) port 80 (#0)
> POST /v1/people/ICshCGDT79/shares HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
> Host: api.linkedin.com
> Accept: */*
> Authorization: OAuth oauth_consumer_key="V9uKPtEEB7JxQvYzbR2DuDfLe4qXjASgP5UhPJp8k13CYgSnN3BRFILxUJ6ApuCH",oauth_token="d6af5cda-b46e-4c38-b566-11428a9584fc",oauth_signature_method="HMAC-SHA1",oauth_signature="1PofnBExFc7pMB8b08fV34B5sTg%3D",oauth_timestamp="1323544645",oauth_nonce="516e0a1eadda4c24bfbcc4ca5e0cbedc",oauth_version="1.0"
> Content-Type: application/json
> Content-Length: 120
>
< HTTP/1.1 401 Unauthorized
< Server: Apache-Coyote/1.1
< Date: Sat, 10 Dec 2011 19:17:14 GMT
< Vary: *
< x-li-format: xml
< Content-Type: text/xml;charset=UTF-8
< Content-Length: 393
<
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error>
<status>401</status>
<timestamp>1323544635447</timestamp>
<request-id>9UR4KT2T5Z</request-id>
<error-code>0</error-code>
<message>[unauthorized]. OAU:V9uKPtEEB7JxQvYzbR2DuDfLe4qXjASgP5UhPJp8k13CYgSnN3BRFILxUJ6ApuCH|d6af5cda-b46e-4c38-b566-11428a9584fc|*01|*01:1323544645:1PofnBExFc7pMB8b08fV34B5sTg=</message>
</error>
* Connection #0 to host api.linkedin.com left intact
* Closing connection #0
任何人都可以告诉我哪里错了?
谢谢,