curl "https://connect.maklare.vitec.net/Advertising/Brand/List/StringValue?PageSize=0&PageIndex=0&ChangedAtMinValue=2015-01-01T12:00:00&ChangedAtMaxValue=2015-01-01T12:00:00" -X GET -H "Authorization: basic {Base64 kodad användarnamn och lösenord}"
Dokumentation för API-funktioner
GET Advertising/Brand/List/{customerId}
Response Information
Resource Description
Kodexempel
Testformulär
Text input
Response Formats
Hämta lista av varumärken för hemsida.
Request Information URI ParametersNamn | Beskrivning | Typ | Information |
customerId | string |
Krävs |
|
Paging | Sidhantering | Paging | |
ChangedAtMinValue | Ändringsdatum minvärde | date | |
ChangedAtMaxValue | Ändringsdatum maxvärde | date |
Hämta lista av varumärken för hemsida.
PageOfAdvertising_AdvertisingBrandNamn | Beskrivning | Typ | Information |
Index | integer | ||
Count | integer | ||
TotalRowCount | integer | ||
Rows | Collection of AdvertisingBrand |
$URL = "https://connect.maklare.vitec.net/Advertising/Brand/List/StringValue?PageSize=0&PageIndex=0&ChangedAtMinValue=2015-01-01T12:00:00&ChangedAtMaxValue=2015-01-01T12:00:00"
Invoke-WebRequest -Uri $URL -Method GET -Headers @{"authorization" = "basic {Base64 kodad användarnamn och lösenord}"}
// HttpClientInstance ska deklareras som en singleton
// public static readonly HttpClient HttpClientInstance = new HttpClient {
// BaseAddress = new Uri("https://connect.maklare.vitec.net"),
// DefaultRequestHeaders = {
// Authorization = new AuthenticationHeaderValue("Basic", "{Base64 kodad användarnamn och lösenord}")
// }
// }
using (var response = await HttpClientInstance.GetAsync("Advertising/Brand/List/StringValue?PageSize=0&PageIndex=0&ChangedAtMinValue=2015-01-01T12:00:00&ChangedAtMaxValue=2015-01-01T12:00:00")) {
if (response.StatusCode == HttpStatusCode.Unauthorized) {
// Authorization headern är inte korrekt
}
if (response.StatusCode == HttpStatusCode.Forbidden) {
// Begärt data som det saknas åtkomst till
}
if (response.StatusCode == HttpStatusCode.InternalServerError) {
// Oväntat fel, kontakta Vitec
}
if (response.StatusCode == HttpStatusCode.BadRequest) {
var json = await response.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject<dynamic>(json);
// Hantera valideringsfel, presenteras i resultatet
}
var json = await response.Content.ReadAsStringAsync();
// JsonConvert finns i biblioteket Newtonsoft.Json
var result = JsonConvert.DeserializeObject<dynamic>(json);
var index = result.index.Value ;
// TODO: Gör något med resultatet
}
$URL = "https://connect.maklare.vitec.net/Advertising/Brand/List/StringValue?PageSize=0&PageIndex=0&ChangedAtMinValue=2015-01-01T12:00:00&ChangedAtMaxValue=2015-01-01T12:00:00";
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERNAME, "{Användarnamn}");
curl_setopt($ch, CURLOPT_PASSWORD, "{Lösenord}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $URL);
$result = curl_exec($ch);
if (curl_errno($ch)) {
die(curl_getinfo($ch));
}
$info = curl_getinfo($ch);
curl_close($ch);
$http_code = $info["http_code"];
if ($http_code == 401) {
// Användarnamnet eller lösenordet är felaktigt
}
if ($http_code == 403) {
// Begärt data som det saknas åtkomst till
}
if ($http_code == 500) {
// Oväntat fel, kontakta Vitec
}
if ($http_code == 400) {
$json = json_decode($result, true);
// Hantera valideringsfel, presenteras i $json
}
$field_on_result = $result["index"];
// TODO: Gör något med resultatet
Resultat av begäran
{ "index": 1, "count": 2, "totalRowCount": 3, "rows": [ { "id": "sample string 1", "name": "sample string 2", "createdAt": "2025-04-04T14:32:01.5294902+02:00", "changedAt": "2025-04-04T14:32:01.5294902+02:00", "segments": [ { "id": "sample string 1", "name": "sample string 2", "createdAt": "2025-04-04T14:32:01.5294902+02:00", "changedAt": "2025-04-04T14:32:01.5294902+02:00" }, { "id": "sample string 1", "name": "sample string 2", "createdAt": "2025-04-04T14:32:01.5294902+02:00", "changedAt": "2025-04-04T14:32:01.5294902+02:00" } ] }, { "id": "sample string 1", "name": "sample string 2", "createdAt": "2025-04-04T14:32:01.5294902+02:00", "changedAt": "2025-04-04T14:32:01.5294902+02:00", "segments": [ { "id": "sample string 1", "name": "sample string 2", "createdAt": "2025-04-04T14:32:01.5294902+02:00", "changedAt": "2025-04-04T14:32:01.5294902+02:00" }, { "id": "sample string 1", "name": "sample string 2", "createdAt": "2025-04-04T14:32:01.5294902+02:00", "changedAt": "2025-04-04T14:32:01.5294902+02:00" } ] } ] }
<PageOfAdvertisingBrandMjTPm89K xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models"> <Count>2</Count> <Index>1</Index> <Rows xmlns:d2p1="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Services.Advertising"> <d2p1:AdvertisingBrand> <d2p1:ChangedAt>2025-04-04T14:32:01.5294902+02:00</d2p1:ChangedAt> <d2p1:CreatedAt>2025-04-04T14:32:01.5294902+02:00</d2p1:CreatedAt> <d2p1:Id>sample string 1</d2p1:Id> <d2p1:Name>sample string 2</d2p1:Name> <d2p1:Segments> <d2p1:AdvertisingBrandSegment> <d2p1:ChangedAt>2025-04-04T14:32:01.5294902+02:00</d2p1:ChangedAt> <d2p1:CreatedAt>2025-04-04T14:32:01.5294902+02:00</d2p1:CreatedAt> <d2p1:Id>sample string 1</d2p1:Id> <d2p1:Name>sample string 2</d2p1:Name> </d2p1:AdvertisingBrandSegment> <d2p1:AdvertisingBrandSegment> <d2p1:ChangedAt>2025-04-04T14:32:01.5294902+02:00</d2p1:ChangedAt> <d2p1:CreatedAt>2025-04-04T14:32:01.5294902+02:00</d2p1:CreatedAt> <d2p1:Id>sample string 1</d2p1:Id> <d2p1:Name>sample string 2</d2p1:Name> </d2p1:AdvertisingBrandSegment> </d2p1:Segments> </d2p1:AdvertisingBrand> <d2p1:AdvertisingBrand> <d2p1:ChangedAt>2025-04-04T14:32:01.5294902+02:00</d2p1:ChangedAt> <d2p1:CreatedAt>2025-04-04T14:32:01.5294902+02:00</d2p1:CreatedAt> <d2p1:Id>sample string 1</d2p1:Id> <d2p1:Name>sample string 2</d2p1:Name> <d2p1:Segments> <d2p1:AdvertisingBrandSegment> <d2p1:ChangedAt>2025-04-04T14:32:01.5294902+02:00</d2p1:ChangedAt> <d2p1:CreatedAt>2025-04-04T14:32:01.5294902+02:00</d2p1:CreatedAt> <d2p1:Id>sample string 1</d2p1:Id> <d2p1:Name>sample string 2</d2p1:Name> </d2p1:AdvertisingBrandSegment> <d2p1:AdvertisingBrandSegment> <d2p1:ChangedAt>2025-04-04T14:32:01.5294902+02:00</d2p1:ChangedAt> <d2p1:CreatedAt>2025-04-04T14:32:01.5294902+02:00</d2p1:CreatedAt> <d2p1:Id>sample string 1</d2p1:Id> <d2p1:Name>sample string 2</d2p1:Name> </d2p1:AdvertisingBrandSegment> </d2p1:Segments> </d2p1:AdvertisingBrand> </Rows> <TotalRowCount>3</TotalRowCount> </PageOfAdvertisingBrandMjTPm89K>