Breaking News
Home / iOS / iOS Snippets / LinkedIn Error : Using GET instead of POST for Messaging API

LinkedIn Error : Using GET instead of POST for Messaging API

Issue

2011-05-30 17:57:03.496 App[34905:207] <0x6584fa0 LinkedInContactViewController.m:(302)> socialize
2011-05-30 17:57:03.497 App[34905:207] <0x6594060 LinkedInService.m:(198)> sendMessage
2011-05-30 17:57:03.498 App[34905:207] <0x6576fe0 LinkedInMessageRequest.m:(31)> transform to url
2011-05-30 17:57:03.498 App[34905:207] <0x6576fe0 LinkedInMessageRequest.m:(42)> in : transformToXml
2011-05-30 17:57:03.499 App[34905:207] <0x6576fe0
LinkedInMessageRequest.m:(57)> Adding Recipient /people/4jBYb-gd-d
2011-05-30 17:57:03.500 App[34905:207] <0x6594060
LinkedInService.m:(92)> URL :
http://api.linkedin.com/v1/people/~/mailbox
2011-05-30 17:57:03.501 App[34905:207] <0x34fe6c OAuthViewController.m:(210)> im : authForLinkedIn
2011-05-30 17:57:03.502 App[34905:207] signing request:
<NSMutableURLRequest http://api.linkedin.com/v1/people/~/mailbox>
2011-05-30 17:57:03.503 App[34905:207] signing params: (
    “oauth_consumer_key=qa7OEDcdD1xbsNTu1xHUpVecp-wgGYRSwooSNgyLWTOYFcZ3f9Gcf8JTfiHA2maM”,
    “oauth_token=6f2b6d4a-7c8a-4355-b50f-3e3e7e72213”,
    “oauth_signature_method=HMAC-SHA1”,
    “oauth_version=1.0”,
    “oauth_nonce=3459080789480089504”,
    “oauth_timestamp=1306803423”
)
2011-05-30 17:57:03.504 App[34905:207] hashing:
qI7YW6eZ9C06acVX0MUah_rtl1iEsCJTQ1RVkTx7b9UFg43she9NeAQIuLihkM0D&8ed5824c-1f51-4231-9312-e29f5f823e02
2011-05-30 17:57:03.504 App[34905:207] base string: GET&http%3A%2F%2Fapi.linkedin.com%2Fv1%2Fpeople%2F~%2Fmailbox&oauth_consumer_key%3Dqa7OEDcdD1xbsNTu1xHUpVecp-wgGYRSwooSNgyLWTOYFcZ3f9Gcf8JsTfiHA2maM%26oauth_nonce%3D3459080789480089504%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1306803423%26oauth_token%3D6f2b6d4a-7c8a-4355-b50f-3e3e7e728f13%26oauth_version%3D1.0
2011-05-30 17:57:03.505 App[34905:207] signature: CB4G4LzHWrPpMD9ppvilx7uVfgs=
2011-05-30 17:57:03.506 App[34905:207] adding auth header:
OAuth
oauth_consumer_key=”qa7OEDcdD1xbsNTu1xHUpVecp-wgGYRSwooSNgyLWTOYFcZ3f9Gcf8JTfiHA2maM”,
oauth_token=”6f2b6d4a-7c8a-4355-b50f-3e3e7e728f13″,
oauth_signature_method=”HMAC-SHA1″, oauth_version=”1.0″,
oauth_nonce=”3459080789480089504″, oauth_timestamp=”1306803423″,
oauth_signature=”CB4G4LzHWrPpMD9ppvilx7uVfgs%3D”
2011-05-30 17:57:03.507 App[34905:207] final request:
<NSMutableURLRequest http://api.linkedin.com/v1/people/~/mailbox>
2011-05-30 17:57:03.508 App[34905:207] <0x6594060 LinkedInService.m:(120)> Its a GET request
2011-05-30 17:57:03.508 App[34905:207] <0x6594060 LinkedInService.m:(123)> get data <?xml version=”1.0″?>
<mailbox-item><recipients><recipient><people

path=”/people/4jBYb-gd-d”/></recipient></recipients><subject>Test

Message</subject><body>Test</body></mailbox-item>
2011-05-30 17:57:04.401 App[34905:207] <0x6594060 LinkedInService.m:(139)> response <?xml version=”1.0″ encoding=”UTF-8″ standalone=”yes”?>
<error>
  <status>401</status>
  <timestamp>1306803424372</timestamp>
  <error-code>0</error-code>
  <message>[unauthorized].
OAU:qa7OEDcdD1xbsNTu1xHUpVecp-wgGYRSwooSNgyLWTOYFcZ3f9Gcf8JTfiHA2maM|6f2b6d4a-7c8a-4355-b50f-3e3e7e728f13|*01|*01:1306803423:CB4G4LzHWrPpMD9ppvilx7uVfgs=</message>

</error>

Resolution

Make sure you are using HTTP POST method instead of GET. This will solve the issue.

[pb_builder]

Check Also

EKCalendar – That account does not allow calendars to be added or removed

Usecase When I am trying to create a new Calendar programmatically using the EventKit API …

Advertisment ad adsense adlogger