curl "https://connect.maklare.vitec.net/BusinessIntelligence/External/Offices?customerId=StringValue" -X GET -H "Authorization: basic {Base64 kodad användarnamn och lösenord}"
Dokumentation för API-funktioner
GET BusinessIntelligence/External/Offices
Hämtar kontor
Request Information
URI Parameters
Response Information
Resource Description
Hämtar kontor
Collection of Office
Kodexempel
Testformulär
Text input
Response Formats
Namn | Beskrivning | Typ | Information |
customerId | Grupp eller Kund-id | string |
Krävs |
Namn | Beskrivning | Typ | Information |
Id | Id på kontor | string | |
Name | Namn på kontor | string | |
Homepage | Url till kontorets hemsida | string | |
EmailAddress | E-postadress till kontoret | string | |
CorporateNumber | Organisationsnummer | string | |
LegalName | Juridiskt namn | string | |
ChangedAt | Ändringsdatum | date | |
Description | Beskrivning av kontoret | string | |
Address | Besöksadress eller postadress | string | |
ZipCode | Postnummer | string | |
City | Postort | string | |
coordinate | Koordinat | Coordinate | |
TelePhone | Telefonnummer | string |
$URL = "https://connect.maklare.vitec.net/BusinessIntelligence/External/Offices?customerId=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("BusinessIntelligence/External/Offices?customerId=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/BusinessIntelligence/External/Offices?customerId=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
Resultat av begäran
[ { "id": "sample string 1", "name": "sample string 2", "homepage": "sample string 3", "emailAddress": "sample string 4", "corporateNumber": "sample string 5", "legalName": "sample string 6", "changedAt": "2024-11-21T10:06:34.391747+01:00", "description": "sample string 8", "address": "sample string 9", "zipCode": "sample string 10", "city": "sample string 11", "coordinate": { "longitud": 1.1, "latitud": 2.1 }, "telePhone": "sample string 12" }, { "id": "sample string 1", "name": "sample string 2", "homepage": "sample string 3", "emailAddress": "sample string 4", "corporateNumber": "sample string 5", "legalName": "sample string 6", "changedAt": "2024-11-21T10:06:34.391747+01:00", "description": "sample string 8", "address": "sample string 9", "zipCode": "sample string 10", "city": "sample string 11", "coordinate": { "longitud": 1.1, "latitud": 2.1 }, "telePhone": "sample string 12" } ]
<ArrayOfOffice xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.BusinessIntelligense.External"> <Office> <Address>sample string 9</Address> <ChangedAt>2024-11-21T10:06:34.391747+01:00</ChangedAt> <City>sample string 11</City> <CorporateNumber>sample string 5</CorporateNumber> <Description>sample string 8</Description> <EmailAddress>sample string 4</EmailAddress> <Homepage>sample string 3</Homepage> <Id>sample string 1</Id> <LegalName>sample string 6</LegalName> <Name>sample string 2</Name> <TelePhone>sample string 12</TelePhone> <ZipCode>sample string 10</ZipCode> <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> </Office> <Office> <Address>sample string 9</Address> <ChangedAt>2024-11-21T10:06:34.391747+01:00</ChangedAt> <City>sample string 11</City> <CorporateNumber>sample string 5</CorporateNumber> <Description>sample string 8</Description> <EmailAddress>sample string 4</EmailAddress> <Homepage>sample string 3</Homepage> <Id>sample string 1</Id> <LegalName>sample string 6</LegalName> <Name>sample string 2</Name> <TelePhone>sample string 12</TelePhone> <ZipCode>sample string 10</ZipCode> <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> </Office> </ArrayOfOffice>