I'm new to using HTTP, as I have traditionally been a front-end developer only, but with my current contract I'm being asked to use a REST API to pull data from a server. I need to authenticate myself in the HTTP header with an API Key and API User Name and I'm being asked to do so in the "token" header according to the API documentation.
Can I get any help with how I would format an NSURLRequest
to accomplish this task? I'm completely lost here.
Here is the specific part of the API documentation I'm referencing:
REST-APIUser—Token
The APIKey and APIUserName associated with the account have to be set to “REST-APIUser--Token” in Base64String Format in the token header as illustrated below: Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Format("{0}:{1}",APIKey,APIUserName)))
Where,
APIKey – The Unique key associated with an API account
APIUserName – The UserName associated with an API account
APP-User-ID
ID of the currently logged in User has to be set to “APP-User-ID” in Base64String Format in the header. Convert.ToBase64String(Encoding.UTF8.GetBytes(AppUserID))
Where,
AppUserID – The User ID associated with the API application user
I am in possession of an {APIKey}, {APIUserName}, and an {AppUserID}.