Hi Don,
Thanks for your input, I learnt a lot, Sadly none worked. This however is close.
Code:
Dim myToken As String = "ABC123def456GHI789jkl0"
Dim j As HttpJob
j.Initialize("j", Me)
j.Head("https://connect.squareup.com/v2/locations")
j.GetRequest.SetHeader("Authorization", "Bearer " & myToken)
Log(j.Download("https://connect.squareup.com/v2/locations"))
if I take out j.Head("
https://connect.squareup.com/v2/locations") which is link as string, it does not work at all.
The error I get is:
ResponseError. Reason: Unauthorized, Response: {"errors":[{"category":"AUTHENTICATION_ERROR","code":"UNAUTHORIZED","detail":"Your request did not include an `Authorization` http header with an access token. The header value is expected to be of the format \"Bearer TOKEN\" (without quotation marks), where TOKEN is to be replaced with your access token (e.g. \"Bearer ABC123def456GHI789jkl0\")
The key is "Authorization" the value "Bearer & token"
Also It will return a json string, How would I handle this. The returned json structure is lie this:
{
"locations": [
{
"id": "9XX7D69CH0K4V",
"name": "02",
"address": {
"address_line_1": "Rose Bank",
"locality": "Cust",
"postal_code": "1740",
"country": "NZ"
},
"timezone": "America/Los_Angeles",
"status": "ACTIVE",
"created_at": "2018-02-28T22:25:58Z",
"merchant_id": "XXXXXXXXXXXXX",
"country": "NZ",
"language_code": "en",
"currency": "NZD",
"business_name": "generoSTUDIO",
"type": "PHYSICAL"
},
{
"id": "EPXKCYY7KKG22",
"name": "01",
"address": {
"address_line_1": "1347 Rosebank",
"locality": "Cust",
"postal_code": "1740",
"country": "NZ"
},
"timezone": "America/Los_Angeles",
"status": "ACTIVE",
"created_at": "2017-08-17T09:53:32Z",
"merchant_id": "XXXXXXXXXXXXX",
"country": "NZ",
"language_code": "en",
"currency": "NZD",
"business_name": "generoSTUDIO",
"type": "PHYSICAL"
},
{
"id": "KZHN4N3JTM9G6",
"name": "
[email protected]",
"address": {
"country": "NZ"
},
"timezone": "Pacific/Auckland",
"status": "INACTIVE",
"created_at": "2017-08-17T00:56:02Z",
"merchant_id": "XXXXXXXXXXXX",
"country": "NZ",
"language_code": "en",
"currency": "NZD",
"business_name": "
[email protected]",
"type": "PHYSICAL"
},
{
"id": "ZZ5SJS8XK83CW",
"name": "03",
"address": {
"address_line_1": "RoseBank",
"locality": "Cust",
"postal_code": "1740",
"country": "NZ"
},
"timezone": "America/Los_Angeles",
"status": "ACTIVE",
"created_at": "2018-02-28T22:26:23Z",
"merchant_id": "XXXXXXXXXXXXX",
"country": "NZ",
"language_code": "en",
"currency": "NZD",
"business_name": "generoSTUDIO",
"type": "PHYSICAL"
}
]
}
Is there anywhere I can read a tutorial?
Thanks Phil