Is it possible for c# (winform) to get iCloud contact list? Does apple have an API for that on C#?

I found somes examples for getting iCloud contact list on python and NodeJS, I wonder there is one on C#(winform).


The examples I found are:

Python: https://github.com/mindcollapse/iCloud-API/blob/master/iCloud.py

NodeJS: https://www.snip2code.com/Snippet/65033/Request-Contact-List-From-iCloud


When parsing these code to C#, I successfuly call authenticated url to get my contact server address, dsid...

But when I try to call get contact list url, server returns me 421:Client Error, I dont know why that happens ! Does Apple support C# or not ?


My get contact list url:

https://p35-contactsws.icloud.com/co/startup?clientBuildNumber=1P24&clientId=MyGuid&clientVersion=2.1&dsid=MyDSID&locale=en_US&order=last%2Cfirst


Note: https://p35-contactsws.icloud.com is my contact server, it actually is https://p35-contactsws.icloud.com:443, but base on example I refer to, the port :443 need to be removed.


Please someone help me.

Replies

You must first send a POST with credentials to https://setup.icloud.com/setup/ws/1/login to get the user and token values (X-APPLE-WEBAUTH-TOKEN and X-APPLE-WEBAUTH-USER which are returned in the cookies) and send them as cookies with your GET request.

Hello, I recently developed icloud-related technology, but I didn't find the api of "https://setup.icloud.com/setup/ws/1/login". I don't know where you got it from?


thanks