Dokumentation för API-funktioner
GET Viewing/{customerId}/{estateId} Hämta visningar för en bostad. Request Information URI Parameters
NamnBeskrivningTypInformation
estateId Bostadsid string Krävs
customerId Kundid string

Response Information Resource Description Hämta visningar för en bostad. Collection of Viewing
NamnBeskrivningTypInformation
Id Id på visningen string

StartsAt Starttid date

EndsAt Sluttid date

ShowOnInternet Visas på internet boolean

ShowOnIntranet Visa i inloggat läge/Mina sidor boolean

IsDigital Digital visning boolean

Commentary Kommentar string

ParticipantPerTimeSlot Max antal deltagare per visningtillfälle integer

BookableFromInternet Bokningsbar på internet boolean

NoLaterThen Bokningsbar på internet fram till date

BookingUrl URL till till Bookning string

TimeSlots Visningstillfällen Collection of TimeSlot

EstateId Id på objektet string

IsProjectViewing Projekt visning (visas på alla objekt i projektet) boolean

Kodexempel

curl "https://connect.maklare.vitec.net/Viewing/StringValue/StringValue" -X GET -H "Authorization: basic {Base64 kodad användarnamn och lösenord}" 
            

$URL = "https://connect.maklare.vitec.net/Viewing/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("Viewing/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 firstInArray = result[0];
    var id = firstInArray.id.Value;
    // TODO: Gör något med resultatet
}

$URL = "https://connect.maklare.vitec.net/Viewing/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
}

$first = $result[0];
$field_on_result = $first["id"];
// TODO: Gör något med resultatet
Testformulär Text input
Response Formats
[
  {
    "id": "sample string 1",
    "startsAt": "2024-11-21T11:21:24.0088892+01:00",
    "endsAt": "2024-11-21T11:21:24.0088892+01:00",
    "showOnInternet": true,
    "showOnIntranet": true,
    "isDigital": true,
    "commentary": "sample string 5",
    "participantPerTimeSlot": 6,
    "bookableFromInternet": true,
    "noLaterThen": "2024-11-21T11:21:24.0088892+01:00",
    "bookingUrl": "sample string 8",
    "timeSlots": [
      {
        "id": "sample string 1",
        "startsAt": "2024-11-21T11:21:24.0088892+01:00",
        "endsAt": "2024-11-21T11:21:24.0088892+01:00",
        "participants": [
          {
            "hasParticipated": true,
            "contactId": "sample string 2"
          },
          {
            "hasParticipated": true,
            "contactId": "sample string 2"
          }
        ]
      },
      {
        "id": "sample string 1",
        "startsAt": "2024-11-21T11:21:24.0088892+01:00",
        "endsAt": "2024-11-21T11:21:24.0088892+01:00",
        "participants": [
          {
            "hasParticipated": true,
            "contactId": "sample string 2"
          },
          {
            "hasParticipated": true,
            "contactId": "sample string 2"
          }
        ]
      }
    ],
    "estateId": "sample string 9",
    "isProjectViewing": true
  },
  {
    "id": "sample string 1",
    "startsAt": "2024-11-21T11:21:24.0088892+01:00",
    "endsAt": "2024-11-21T11:21:24.0088892+01:00",
    "showOnInternet": true,
    "showOnIntranet": true,
    "isDigital": true,
    "commentary": "sample string 5",
    "participantPerTimeSlot": 6,
    "bookableFromInternet": true,
    "noLaterThen": "2024-11-21T11:21:24.0088892+01:00",
    "bookingUrl": "sample string 8",
    "timeSlots": [
      {
        "id": "sample string 1",
        "startsAt": "2024-11-21T11:21:24.0088892+01:00",
        "endsAt": "2024-11-21T11:21:24.0088892+01:00",
        "participants": [
          {
            "hasParticipated": true,
            "contactId": "sample string 2"
          },
          {
            "hasParticipated": true,
            "contactId": "sample string 2"
          }
        ]
      },
      {
        "id": "sample string 1",
        "startsAt": "2024-11-21T11:21:24.0088892+01:00",
        "endsAt": "2024-11-21T11:21:24.0088892+01:00",
        "participants": [
          {
            "hasParticipated": true,
            "contactId": "sample string 2"
          },
          {
            "hasParticipated": true,
            "contactId": "sample string 2"
          }
        ]
      }
    ],
    "estateId": "sample string 9",
    "isProjectViewing": true
  }
]
<ArrayOfViewing xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Viewing">
  <Viewing>
    <BookableFromInternet>true</BookableFromInternet>
    <BookingUrl>sample string 8</BookingUrl>
    <Commentary>sample string 5</Commentary>
    <EndsAt>2024-11-21T11:21:24.0088892+01:00</EndsAt>
    <EstateId>sample string 9</EstateId>
    <Id>sample string 1</Id>
    <IsDigital>true</IsDigital>
    <IsProjectViewing>true</IsProjectViewing>
    <NoLaterThen>2024-11-21T11:21:24.0088892+01:00</NoLaterThen>
    <ParticipantPerTimeSlot>6</ParticipantPerTimeSlot>
    <ShowOnInternet>true</ShowOnInternet>
    <ShowOnIntranet>true</ShowOnIntranet>
    <StartsAt>2024-11-21T11:21:24.0088892+01:00</StartsAt>
    <TimeSlots>
      <TimeSlot>
        <EndsAt>2024-11-21T11:21:24.0088892+01:00</EndsAt>
        <Id>sample string 1</Id>
        <Participants>
          <Participant>
            <ContactId>sample string 2</ContactId>
            <HasParticipated>true</HasParticipated>
          </Participant>
          <Participant>
            <ContactId>sample string 2</ContactId>
            <HasParticipated>true</HasParticipated>
          </Participant>
        </Participants>
        <StartsAt>2024-11-21T11:21:24.0088892+01:00</StartsAt>
      </TimeSlot>
      <TimeSlot>
        <EndsAt>2024-11-21T11:21:24.0088892+01:00</EndsAt>
        <Id>sample string 1</Id>
        <Participants>
          <Participant>
            <ContactId>sample string 2</ContactId>
            <HasParticipated>true</HasParticipated>
          </Participant>
          <Participant>
            <ContactId>sample string 2</ContactId>
            <HasParticipated>true</HasParticipated>
          </Participant>
        </Participants>
        <StartsAt>2024-11-21T11:21:24.0088892+01:00</StartsAt>
      </TimeSlot>
    </TimeSlots>
  </Viewing>
  <Viewing>
    <BookableFromInternet>true</BookableFromInternet>
    <BookingUrl>sample string 8</BookingUrl>
    <Commentary>sample string 5</Commentary>
    <EndsAt>2024-11-21T11:21:24.0088892+01:00</EndsAt>
    <EstateId>sample string 9</EstateId>
    <Id>sample string 1</Id>
    <IsDigital>true</IsDigital>
    <IsProjectViewing>true</IsProjectViewing>
    <NoLaterThen>2024-11-21T11:21:24.0088892+01:00</NoLaterThen>
    <ParticipantPerTimeSlot>6</ParticipantPerTimeSlot>
    <ShowOnInternet>true</ShowOnInternet>
    <ShowOnIntranet>true</ShowOnIntranet>
    <StartsAt>2024-11-21T11:21:24.0088892+01:00</StartsAt>
    <TimeSlots>
      <TimeSlot>
        <EndsAt>2024-11-21T11:21:24.0088892+01:00</EndsAt>
        <Id>sample string 1</Id>
        <Participants>
          <Participant>
            <ContactId>sample string 2</ContactId>
            <HasParticipated>true</HasParticipated>
          </Participant>
          <Participant>
            <ContactId>sample string 2</ContactId>
            <HasParticipated>true</HasParticipated>
          </Participant>
        </Participants>
        <StartsAt>2024-11-21T11:21:24.0088892+01:00</StartsAt>
      </TimeSlot>
      <TimeSlot>
        <EndsAt>2024-11-21T11:21:24.0088892+01:00</EndsAt>
        <Id>sample string 1</Id>
        <Participants>
          <Participant>
            <ContactId>sample string 2</ContactId>
            <HasParticipated>true</HasParticipated>
          </Participant>
          <Participant>
            <ContactId>sample string 2</ContactId>
            <HasParticipated>true</HasParticipated>
          </Participant>
        </Participants>
        <StartsAt>2024-11-21T11:21:24.0088892+01:00</StartsAt>
      </TimeSlot>
    </TimeSlots>
  </Viewing>
</ArrayOfViewing>