How to get contacts from iCloud using iCloud API?

I want to fetch contacts of iCloud account using iCloud ID and Password. For this I authenticate iCloud account successfully to get Web Token.

Now I try to fetch contacts. I am following this link and my contact URL is:

https://p49-contactsws.icloud.com:443/co/startup?clientBuildNumber=XXX&clientId=XXXXXXXX&clientVersion=2.1&dsid=XXXXXXXX&locale=en-gb_US&order=last%2Cfirst

I also tried it without :443

I am also using request headers as:

Origin: https://www.icloud.com
Cookie: X-APPLE-WEBAUTH-TOKEN=v=2:t=XXXXXXXXX; X-APPLE-WEBAUTH-USER=v=1:s=1:d=XXXXXXXXX

But I am getting 404 Bad Request Error with response:

{
    "requestUUID": "1bc9e987-1f0b-4658-9912-dcf5cc9a2810",
    "errorReason": "Bad Request",
    "errorCode": 400
}

Upvotes: 2

Views: 3390

Answers (1)

Related Questions