I want to use the API to create tickets in my ticket system. I’m trying the most simple call to get the accounts. According to their docs I need to use the following for authorization:
We support HTTP Basic authentication to access the API. The DoneDone API is only available over SSL, so your credentials are safe.
When making calls to the API, provide your email address and api token via the HTTP Basic authorization header, in the form:Authorization: Basic xxxxxxxxxxxxxxxxxxxxx
wherexxxxxxxxxxxxxxxxxxxxx
is the Base64-encoded string in the formemail:apitoken
. Your unique API token is available on the “Your Profile > API Key” section of the DoneDone app. You may also use your password in place of the api token, but we don’t recommend this.
What is wrong with my code?
Dim url As String = "https://2.donedone.com/public-api/accounts"
Dim username As String = "email address"
Dim password As String = "API key"
Dim connection As New URLConnection
Dim authorizationHeader As String = "Basic " + EncodeBase64(username + ":" + password)
connection.RequestHeader("Authorization:") = authorizationHeader
Dim result As String = connection.SendSync("GET", url)
I only get “not authorized” back from the url connection.