curl "https://connect.maklare.vitec.net/PublicAdvertising/Agent/StringValue/StringValue" -X GET -H "Authorization: basic {Base64 kodad användarnamn och lösenord}"
Dokumentation för API-funktioner
GET PublicAdvertising/Agent/{customerId}/{id}
Hämtar mäklare.
Request Information
URI Parameters
Response Information
Resource Description
Hämtar mäklare.
EstateAgent
Kodexempel
Testformulär
Text input
Response Formats
Namn | Beskrivning | Typ | Information |
customerId | Kundid | string |
Krävs |
id | Mäklarens id | string |
Krävs |
Namn | Beskrivning | Typ | Information |
Id | Id | string | |
Name | Namn | string | |
EmailAddress | E-postadress | string | |
ChangedAt | När mäklaren senast ändrades | date | |
Telephone | Telefonnummer | TelephoneNumbers | |
OfficeAffiliations | Mäklarens tillhörigheter till kontor | Collection of EstateAgentOfficeAffiliation | |
Title | Titel | string | |
Image | Bild på mäklaren | Image |
$URL = "https://connect.maklare.vitec.net/PublicAdvertising/Agent/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("PublicAdvertising/Agent/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/PublicAdvertising/Agent/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", "emailAddress": "sample string 3", "changedAt": "2025-01-22T18:09:55.2268136+01:00", "telephone": { "work": "sample string 1", "cell": "sample string 2", "public": "sample string 3" }, "officeAffiliations": [ { "workPhone": "sample string 1", "officeId": "sample string 2", "customerId": "sample string 3" }, { "workPhone": "sample string 1", "officeId": "sample string 2", "customerId": "sample string 3" } ], "title": "sample string 5", "image": { "id": "sample string 1", "dataChangedAt": "2025-01-22T18:09:55.2268136+01:00", "description": "sample string 3", "name": "sample string 4", "category": "Layout", "tags": "sample string 5", "extension": "sample string 6", "cdnReferences": [ { "name": "sample string 1", "url": "sample string 2" }, { "name": "sample string 1", "url": "sample string 2" } ] } }
<EstateAgent xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.PublicAdvertisement"> <ChangedAt>2025-01-22T18:09:55.2268136+01:00</ChangedAt> <EmailAddress>sample string 3</EmailAddress> <Id>sample string 1</Id> <Image> <Category>Layout</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-01-22T18:09:55.2268136+01:00</DataChangedAt> <Description>sample string 3</Description> <Extension>sample string 6</Extension> <Id>sample string 1</Id> <Name>sample string 4</Name> <Tags>sample string 5</Tags> </Image> <Name>sample string 2</Name> <OfficeAffiliations> <EstateAgentOfficeAffiliation> <CustomerId>sample string 3</CustomerId> <OfficeId>sample string 2</OfficeId> <WorkPhone>sample string 1</WorkPhone> </EstateAgentOfficeAffiliation> <EstateAgentOfficeAffiliation> <CustomerId>sample string 3</CustomerId> <OfficeId>sample string 2</OfficeId> <WorkPhone>sample string 1</WorkPhone> </EstateAgentOfficeAffiliation> </OfficeAffiliations> <Telephone> <Cell>sample string 2</Cell> <Public>sample string 3</Public> <Work>sample string 1</Work> </Telephone> <Title>sample string 5</Title> </EstateAgent>