curl "https://connect.maklare.vitec.net/v2/Advertising/Form/StringValue/Estate/StringValue" -X GET -H "Authorization: basic {Base64 kodad användarnamn och lösenord}"
Dokumentation för API-funktioner
GET v2/Advertising/Form/{customerId}/Estate/{estateId}
Hämtar bostadsinformation som behövs för kontaktformulär
Request Information
URI Parameters
Response Information
Resource Description
Hämtar bostadsinformation som behövs för kontaktformulär
AdvertisingFormContactEstate
Kodexempel
Testformulär
Text input
Response Formats
Namn | Beskrivning | Typ | Information |
customerId | Kund-id | string |
Krävs |
estateId | Id för aktuell bostad | string |
Krävs |
Namn | Beskrivning | Typ | Information |
Id | Id på bostaden | string | |
Office | Kontor | AdvertisingFormContactEstateOffice | |
Agents | Handläggare kopplade till bostaden, en av dem kommer att vara primär | Collection of AdvertisingFormContactEstateAgent | |
Address | Adressuppgifter | AdvertisingFormContactEstateAddress | |
Viewings | Visningar | Collection of AdvertisingFormContactEstateViewing |
$URL = "https://connect.maklare.vitec.net/v2/Advertising/Form/StringValue/Estate/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("v2/Advertising/Form/StringValue/Estate/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/v2/Advertising/Form/StringValue/Estate/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", "office": { "customerId": "sample string 1", "name": "sample string 2" }, "agents": [ { "id": "sample string 1", "name": "sample string 2", "email": "sample string 3", "isPrimary": true }, { "id": "sample string 1", "name": "sample string 2", "email": "sample string 3", "isPrimary": true } ], "address": { "unitDesignation": "sample string 1", "streetAddress": "sample string 2", "zipCode": "sample string 3", "city": "sample string 4", "coordinate": { "longitude": 1.1, "latitude": 2.1 } }, "viewings": [ { "id": "sample string 1", "startsAt": "2025-04-04T15:26:25.4285299+02:00", "endsAt": "2025-04-04T15:26:25.4285299+02:00", "deadlineAt": "2025-04-04T15:26:25.4285299+02:00", "isSelfRegistrationEnabled": true, "isVisible": true, "timeSlots": [ { "id": "sample string 1", "startsAt": "2025-04-04T15:26:25.4285299+02:00", "endsAt": "2025-04-04T15:26:25.4285299+02:00", "isRegistrationAvailable": true }, { "id": "sample string 1", "startsAt": "2025-04-04T15:26:25.4285299+02:00", "endsAt": "2025-04-04T15:26:25.4285299+02:00", "isRegistrationAvailable": true } ] }, { "id": "sample string 1", "startsAt": "2025-04-04T15:26:25.4285299+02:00", "endsAt": "2025-04-04T15:26:25.4285299+02:00", "deadlineAt": "2025-04-04T15:26:25.4285299+02:00", "isSelfRegistrationEnabled": true, "isVisible": true, "timeSlots": [ { "id": "sample string 1", "startsAt": "2025-04-04T15:26:25.4285299+02:00", "endsAt": "2025-04-04T15:26:25.4285299+02:00", "isRegistrationAvailable": true }, { "id": "sample string 1", "startsAt": "2025-04-04T15:26:25.4285299+02:00", "endsAt": "2025-04-04T15:26:25.4285299+02:00", "isRegistrationAvailable": true } ] } ] }
<AdvertisingFormContactEstate xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Services.Advertising"> <Address> <City>sample string 4</City> <Coordinate xmlns:d3p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models"> <d3p1:Latitude>2.1</d3p1:Latitude> <d3p1:Longitude>1.1</d3p1:Longitude> </Coordinate> <StreetAddress>sample string 2</StreetAddress> <UnitDesignation>sample string 1</UnitDesignation> <ZipCode>sample string 3</ZipCode> </Address> <Agents> <AdvertisingFormContactEstateAgent> <Email>sample string 3</Email> <Id>sample string 1</Id> <IsPrimary>true</IsPrimary> <Name>sample string 2</Name> </AdvertisingFormContactEstateAgent> <AdvertisingFormContactEstateAgent> <Email>sample string 3</Email> <Id>sample string 1</Id> <IsPrimary>true</IsPrimary> <Name>sample string 2</Name> </AdvertisingFormContactEstateAgent> </Agents> <Id>sample string 1</Id> <Office> <CustomerId>sample string 1</CustomerId> <Name>sample string 2</Name> </Office> <Viewings> <AdvertisingFormContactEstateViewing> <DeadlineAt>2025-04-04T15:26:25.4285299+02:00</DeadlineAt> <EndsAt>2025-04-04T15:26:25.4285299+02:00</EndsAt> <Id>sample string 1</Id> <IsSelfRegistrationEnabled>true</IsSelfRegistrationEnabled> <IsVisible>true</IsVisible> <StartsAt>2025-04-04T15:26:25.4285299+02:00</StartsAt> <TimeSlots> <AdvertisingFormContactEstateViewingTimeSlot> <EndsAt>2025-04-04T15:26:25.4285299+02:00</EndsAt> <Id>sample string 1</Id> <IsRegistrationAvailable>true</IsRegistrationAvailable> <StartsAt>2025-04-04T15:26:25.4285299+02:00</StartsAt> </AdvertisingFormContactEstateViewingTimeSlot> <AdvertisingFormContactEstateViewingTimeSlot> <EndsAt>2025-04-04T15:26:25.4285299+02:00</EndsAt> <Id>sample string 1</Id> <IsRegistrationAvailable>true</IsRegistrationAvailable> <StartsAt>2025-04-04T15:26:25.4285299+02:00</StartsAt> </AdvertisingFormContactEstateViewingTimeSlot> </TimeSlots> </AdvertisingFormContactEstateViewing> <AdvertisingFormContactEstateViewing> <DeadlineAt>2025-04-04T15:26:25.4285299+02:00</DeadlineAt> <EndsAt>2025-04-04T15:26:25.4285299+02:00</EndsAt> <Id>sample string 1</Id> <IsSelfRegistrationEnabled>true</IsSelfRegistrationEnabled> <IsVisible>true</IsVisible> <StartsAt>2025-04-04T15:26:25.4285299+02:00</StartsAt> <TimeSlots> <AdvertisingFormContactEstateViewingTimeSlot> <EndsAt>2025-04-04T15:26:25.4285299+02:00</EndsAt> <Id>sample string 1</Id> <IsRegistrationAvailable>true</IsRegistrationAvailable> <StartsAt>2025-04-04T15:26:25.4285299+02:00</StartsAt> </AdvertisingFormContactEstateViewingTimeSlot> <AdvertisingFormContactEstateViewingTimeSlot> <EndsAt>2025-04-04T15:26:25.4285299+02:00</EndsAt> <Id>sample string 1</Id> <IsRegistrationAvailable>true</IsRegistrationAvailable> <StartsAt>2025-04-04T15:26:25.4285299+02:00</StartsAt> </AdvertisingFormContactEstateViewingTimeSlot> </TimeSlots> </AdvertisingFormContactEstateViewing> </Viewings> </AdvertisingFormContactEstate>