Dokumentation för API-funktioner
GET Office/GetOffice För att kunna hämta företagen så krävs det en giltig API nyckel och ett kundid. Request Information URI Parameters
NamnBeskrivningTypInformation
OfficeId Unik identifierare på butiken string

CustomerId Kontorsid string Required
GroupId Gruppid string

Response Information Resource Description Hämtar företag. Hämtar information om mäklarkontoret. Collection of Office
NamnBeskrivningTypInformation
Archived Arkiverad boolean

CustomerId Kundid string

OfficeId Officeid string

Name Kontorets huvudsakliga namn string

CustomerName Företagsnamn string

LegalCustomerName Juridiskt företagsnamn string

Address Gatuadress string

PostalAddress Postadress string

ZipCode Postnummer string

City Ort string

Telephone Telefon string

CompanyPlace Företagets sätte string

EmailAddress E-postadress string

HomePage Hemsida string

Description Beskrivning Hemsida string

CorporateNumber Organisationsnummer string

Bankgiro Bankgiro string

Postalgiro Plusgiro string

VAT Momsregistreringsnummer string

TaxCertificate F-skattebevis nummer string

Coordinate Kordinater Coordinate

Region Region integer

OfficeNumber Internt kontorsnummer integer

OfficeName Internt kontorsnamn string

Chain Kedjetillhörighet Chain

DateChanged Ändringsdatum date

PrimaryLeadReceiverId Primär tips/lead mottagare string

SubOffice Kontoret är ett underkontor boolean

Groups Grupper företaget ingår. Collection of Group

Kodexempel

curl "https://connect.maklare.vitec.net/Office/GetOffice?OfficeId=StringValue&CustomerId=StringValue&GroupId=StringValue" -X GET -H "Authorization: basic {Base64 kodad användarnamn och lösenord}" 
            

$URL = "https://connect.maklare.vitec.net/Office/GetOffice?OfficeId=StringValue&CustomerId=StringValue&GroupId=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("Office/GetOffice?OfficeId=StringValue&CustomerId=StringValue&GroupId=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 archived = firstInArray.archived.Value;
    // TODO: Gör något med resultatet
}

$URL = "https://connect.maklare.vitec.net/Office/GetOffice?OfficeId=StringValue&CustomerId=StringValue&GroupId=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["archived"];
// TODO: Gör något med resultatet
Testformulär Text input
Response Formats
[
  {
    "archived": true,
    "customerId": "sample string 2",
    "officeId": "sample string 3",
    "name": "sample string 4",
    "customerName": "sample string 5",
    "legalCustomerName": "sample string 6",
    "address": "sample string 7",
    "postalAddress": "sample string 8",
    "zipCode": "sample string 9",
    "city": "sample string 10",
    "telephone": "sample string 11",
    "companyPlace": "sample string 12",
    "emailAddress": "sample string 13",
    "homePage": "sample string 14",
    "description": "sample string 15",
    "corporateNumber": "sample string 16",
    "bankgiro": "sample string 17",
    "postalgiro": "sample string 18",
    "vat": "sample string 19",
    "taxCertificate": "sample string 20",
    "coordinate": {
      "longitud": 1.1,
      "latitud": 2.1
    },
    "region": 1,
    "officeNumber": 1,
    "officeName": "sample string 21",
    "chain": {
      "id": "sample string 1",
      "name": "sample string 2"
    },
    "dateChanged": "2024-11-21T05:02:53.791885+01:00",
    "primaryLeadReceiverId": "sample string 23",
    "subOffice": true,
    "groups": [
      {
        "id": "sample string 1",
        "name": "sample string 2"
      },
      {
        "id": "sample string 1",
        "name": "sample string 2"
      }
    ]
  },
  {
    "archived": true,
    "customerId": "sample string 2",
    "officeId": "sample string 3",
    "name": "sample string 4",
    "customerName": "sample string 5",
    "legalCustomerName": "sample string 6",
    "address": "sample string 7",
    "postalAddress": "sample string 8",
    "zipCode": "sample string 9",
    "city": "sample string 10",
    "telephone": "sample string 11",
    "companyPlace": "sample string 12",
    "emailAddress": "sample string 13",
    "homePage": "sample string 14",
    "description": "sample string 15",
    "corporateNumber": "sample string 16",
    "bankgiro": "sample string 17",
    "postalgiro": "sample string 18",
    "vat": "sample string 19",
    "taxCertificate": "sample string 20",
    "coordinate": {
      "longitud": 1.1,
      "latitud": 2.1
    },
    "region": 1,
    "officeNumber": 1,
    "officeName": "sample string 21",
    "chain": {
      "id": "sample string 1",
      "name": "sample string 2"
    },
    "dateChanged": "2024-11-21T05:02:53.791885+01:00",
    "primaryLeadReceiverId": "sample string 23",
    "subOffice": true,
    "groups": [
      {
        "id": "sample string 1",
        "name": "sample string 2"
      },
      {
        "id": "sample string 1",
        "name": "sample string 2"
      }
    ]
  }
]
<ArrayOfOffice xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Office">
  <Office>
    <Address>sample string 7</Address>
    <Archived>true</Archived>
    <Bankgiro>sample string 17</Bankgiro>
    <Chain>
      <Id>sample string 1</Id>
      <Name>sample string 2</Name>
    </Chain>
    <City>sample string 10</City>
    <CompanyPlace>sample string 12</CompanyPlace>
    <Coordinate xmlns:d3p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models">
      <d3p1:Latitud>2.1</d3p1:Latitud>
      <d3p1:Longitud>1.1</d3p1:Longitud>
    </Coordinate>
    <CorporateNumber>sample string 16</CorporateNumber>
    <CustomerId>sample string 2</CustomerId>
    <CustomerName>sample string 5</CustomerName>
    <DateChanged>2024-11-21T05:02:53.791885+01:00</DateChanged>
    <Description>sample string 15</Description>
    <EmailAddress>sample string 13</EmailAddress>
    <Groups>
      <Group>
        <Id>sample string 1</Id>
        <Name>sample string 2</Name>
      </Group>
      <Group>
        <Id>sample string 1</Id>
        <Name>sample string 2</Name>
      </Group>
    </Groups>
    <HomePage>sample string 14</HomePage>
    <LegalCustomerName>sample string 6</LegalCustomerName>
    <Name>sample string 4</Name>
    <OfficeId>sample string 3</OfficeId>
    <OfficeName>sample string 21</OfficeName>
    <OfficeNumber>1</OfficeNumber>
    <PostalAddress>sample string 8</PostalAddress>
    <Postalgiro>sample string 18</Postalgiro>
    <PrimaryLeadReceiverId>sample string 23</PrimaryLeadReceiverId>
    <Region>1</Region>
    <SubOffice>true</SubOffice>
    <TaxCertificate>sample string 20</TaxCertificate>
    <Telephone>sample string 11</Telephone>
    <VAT>sample string 19</VAT>
    <ZipCode>sample string 9</ZipCode>
  </Office>
  <Office>
    <Address>sample string 7</Address>
    <Archived>true</Archived>
    <Bankgiro>sample string 17</Bankgiro>
    <Chain>
      <Id>sample string 1</Id>
      <Name>sample string 2</Name>
    </Chain>
    <City>sample string 10</City>
    <CompanyPlace>sample string 12</CompanyPlace>
    <Coordinate xmlns:d3p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models">
      <d3p1:Latitud>2.1</d3p1:Latitud>
      <d3p1:Longitud>1.1</d3p1:Longitud>
    </Coordinate>
    <CorporateNumber>sample string 16</CorporateNumber>
    <CustomerId>sample string 2</CustomerId>
    <CustomerName>sample string 5</CustomerName>
    <DateChanged>2024-11-21T05:02:53.791885+01:00</DateChanged>
    <Description>sample string 15</Description>
    <EmailAddress>sample string 13</EmailAddress>
    <Groups>
      <Group>
        <Id>sample string 1</Id>
        <Name>sample string 2</Name>
      </Group>
      <Group>
        <Id>sample string 1</Id>
        <Name>sample string 2</Name>
      </Group>
    </Groups>
    <HomePage>sample string 14</HomePage>
    <LegalCustomerName>sample string 6</LegalCustomerName>
    <Name>sample string 4</Name>
    <OfficeId>sample string 3</OfficeId>
    <OfficeName>sample string 21</OfficeName>
    <OfficeNumber>1</OfficeNumber>
    <PostalAddress>sample string 8</PostalAddress>
    <Postalgiro>sample string 18</Postalgiro>
    <PrimaryLeadReceiverId>sample string 23</PrimaryLeadReceiverId>
    <Region>1</Region>
    <SubOffice>true</SubOffice>
    <TaxCertificate>sample string 20</TaxCertificate>
    <Telephone>sample string 11</Telephone>
    <VAT>sample string 19</VAT>
    <ZipCode>sample string 9</ZipCode>
  </Office>
</ArrayOfOffice>