curl "https://connect.maklare.vitec.net/Advertising/User/StringValue/StringValue" -X GET -H "Authorization: basic {Base64 kodad användarnamn och lösenord}"
Dokumentation för API-funktioner
GET Advertising/User/{customerId}/{userId}
Response Information
Resource Description
Kodexempel
Testformulär
Text input
Response Formats
Hämta användare för hemsida.
Request Information URI ParametersNamn | Beskrivning | Typ | Information |
customerId | Kund-id | string |
Krävs |
userId | Användare-id | string |
Krävs |
Hämta användare för hemsida.
AdvertisingUserNamn | Beskrivning | Typ | Information |
Id | Id | string | |
Name | Namn | string | |
Title | Titel | string | |
Category | Kategori | string | |
EmailAddress | E-postadress | string | |
Description | Beskrivning | string | |
SpokenLanguages | Talade språk | Collection of string | |
ChangedAt | När mäklaren senast ändrades | date | |
Telephone | Telefonnummer | AdvertisingUserTelephoneNumbers | |
Image | Bild | AdvertisingImage | |
Offices | Användarens tillhörighet till kontor | Collection of AdvertisingUserOffice | |
Reviews | Kundomdömen, senaste först | Collection of AdvertisingUserReview |
$URL = "https://connect.maklare.vitec.net/Advertising/User/StringValue/StringValue"
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/User/StringValue/StringValue")) {
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 id = result.id.Value ;
// TODO: Gör något med resultatet
}
$URL = "https://connect.maklare.vitec.net/Advertising/User/StringValue/StringValue";
$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["id"];
// TODO: Gör något med resultatet
Resultat av begäran
{ "id": "sample string 1", "name": "sample string 2", "title": "sample string 3", "category": "sample string 4", "emailAddress": "sample string 5", "description": "sample string 6", "spokenLanguages": [ "sample string 1", "sample string 2" ], "changedAt": "2025-04-04T14:39:31.3247281+02:00", "telephone": { "cell": { "msisdn": "sample string 1", "display": "sample string 2" }, "public": { "msisdn": "sample string 1", "display": "sample string 2" } }, "image": { "id": "sample string 1", "dataChangedAt": "2025-04-04T14:39:31.3257295+02:00", "description": "sample string 3", "name": "sample string 4", "category": { "id": "sample string 1", "name": "sample string 2" }, "extension": "sample string 5", "cdnReferences": [ { "name": "sample string 1", "url": "sample string 2" }, { "name": "sample string 1", "url": "sample string 2" } ] }, "offices": [ { "id": "sample string 1", "customerId": "sample string 2", "telephone": { "personal": { "msisdn": "sample string 1", "display": "sample string 2" } } }, { "id": "sample string 1", "customerId": "sample string 2", "telephone": { "personal": { "msisdn": "sample string 1", "display": "sample string 2" } } } ], "reviews": [ { "text": "sample string 1", "authorName": "sample string 2" }, { "text": "sample string 1", "authorName": "sample string 2" } ] }
<AdvertisingUser xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Services.Advertising"> <Category>sample string 4</Category> <ChangedAt>2025-04-04T14:39:31.3247281+02:00</ChangedAt> <Description>sample string 6</Description> <EmailAddress>sample string 5</EmailAddress> <Id>sample string 1</Id> <Image> <Category> <Id xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models">sample string 1</Id> <Name xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models">sample string 2</Name> </Category> <CdnReferences xmlns:d3p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api"> <d3p1:CdnImageReference> <d3p1:Name>sample string 1</d3p1:Name> <d3p1:Url>sample string 2</d3p1:Url> </d3p1:CdnImageReference> <d3p1:CdnImageReference> <d3p1:Name>sample string 1</d3p1:Name> <d3p1:Url>sample string 2</d3p1:Url> </d3p1:CdnImageReference> </CdnReferences> <DataChangedAt>2025-04-04T14:39:31.3257295+02:00</DataChangedAt> <Description>sample string 3</Description> <Extension>sample string 5</Extension> <Id>sample string 1</Id> <Name>sample string 4</Name> </Image> <Name>sample string 2</Name> <Offices> <AdvertisingUserOffice> <CustomerId>sample string 2</CustomerId> <Id>sample string 1</Id> <Telephone> <Personal xmlns:d5p1="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models"> <d5p1:Display>sample string 2</d5p1:Display> <d5p1:Msisdn>sample string 1</d5p1:Msisdn> </Personal> </Telephone> </AdvertisingUserOffice> <AdvertisingUserOffice> <CustomerId>sample string 2</CustomerId> <Id>sample string 1</Id> <Telephone> <Personal xmlns:d5p1="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models"> <d5p1:Display>sample string 2</d5p1:Display> <d5p1:Msisdn>sample string 1</d5p1:Msisdn> </Personal> </Telephone> </AdvertisingUserOffice> </Offices> <Reviews> <AdvertisingUserReview> <AuthorName>sample string 2</AuthorName> <Text>sample string 1</Text> </AdvertisingUserReview> <AdvertisingUserReview> <AuthorName>sample string 2</AuthorName> <Text>sample string 1</Text> </AdvertisingUserReview> </Reviews> <SpokenLanguages xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d2p1:string>sample string 1</d2p1:string> <d2p1:string>sample string 2</d2p1:string> </SpokenLanguages> <Telephone> <Cell xmlns:d3p1="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models"> <d3p1:Display>sample string 2</d3p1:Display> <d3p1:Msisdn>sample string 1</d3p1:Msisdn> </Cell> <Public xmlns:d3p1="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models"> <d3p1:Display>sample string 2</d3p1:Display> <d3p1:Msisdn>sample string 1</d3p1:Msisdn> </Public> </Telephone> <Title>sample string 3</Title> </AdvertisingUser>