Dokumentation för API-funktioner
POST CRM/Contact/{customerId}/{contactId}/NewAddress Uppdatera personens nya adress. Request Information URI Parameters
NamnBeskrivningTypInformation
customerId Kund-id. string Krävs
contactId Kontaktid. string Krävs
Body Parameters Kontaktens nya adress CrmPersonNewAddress
NamnBeskrivningTypInformation
NewAddressFrom date

Type NewAddressType

EstateId string

Latitude decimal number

Longitude decimal number

StreetAddress Gatuadress string Gatuaddress måste vara mellan 0 och 68 tecken
ZipCode Postnummer string Postnummer måste vara mellan 0 och 15 tecken
City Postort string Postort måste vara mellan 0 och 25 tecken
CountryCode Landskod string Landskod måste vara mellan 0 och 2 tecken

Request Formats

{
  "newAddressFrom": "2024-11-21T11:04:08.9231726+01:00",
  "type": "FromDate",
  "estateId": "sample string 1",
  "latitude": 1.1,
  "longitude": 1.1,
  "streetAddress": "sample string 2",
  "zipCode": "sample string 3",
  "city": "sample string 4",
  "countryCode": "sample string 5"
}
<CrmPersonNewAddress xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models.Contact.Crm">
  <City xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Contact.Crm">sample string 4</City>
  <CountryCode xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Contact.Crm">sample string 5</CountryCode>
  <StreetAddress xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Contact.Crm">sample string 2</StreetAddress>
  <ZipCode xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Contact.Crm">sample string 3</ZipCode>
  <EstateId>sample string 1</EstateId>
  <Latitude>1.1</Latitude>
  <Longitude>1.1</Longitude>
  <NewAddressFrom>2024-11-21T11:04:08.9231726+01:00</NewAddressFrom>
  <Type>FromDate</Type>
</CrmPersonNewAddress>
Response Information Resource Description Uppdatera personens nya adress. string Kodexempel

curl "https://connect.maklare.vitec.net/CRM/Contact/StringValue/StringValue/NewAddress" -X POST -H "Content-Type: application/json" -H "Authorization: basic {Base64 kodad användarnamn och lösenord}" -d {\"newAddressFrom\":\"2015-01-01T12:00:00\",\"type\":0,\"estateId\":\"StringValue\"}
            

$URL = "https://connect.maklare.vitec.net/CRM/Contact/StringValue/StringValue/NewAddress"
$data = "{`"newAddressFrom`":`"2015-01-01T12:00:00`",`"type`":0,`"estateId`":`"StringValue`"}"
Invoke-WebRequest -Uri $URL -Method POST -Headers @{"Content-Type" = "application/json"; "authorization" = "basic {Base64 kodad användarnamn och lösenord}"} -Body $data
                

// 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}")
//     }
// }
var json = "{\"newAddressFrom\":\"2015-01-01T12:00:00\",\"type\":0,\"estateId\":\"StringValue\"}";
using (var response = await HttpClientInstance.PostAsync("CRM/Contact/StringValue/StringValue/NewAddress", new StringContent(json, Encoding.UTF8, "application/json"))) {
    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);
    
    // TODO: Gör något med resultatet
}

$URL = "https://connect.maklare.vitec.net/CRM/Contact/StringValue/StringValue/NewAddress";

$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);
$data = "{\"newAddressFrom\":\"2015-01-01T12:00:00\",\"type\":0,\"estateId\":\"StringValue\"}";
curl_setopt($ch, CURLOPT_POST, true);

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data)
));

$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
}

// TODO: Gör något med resultatet
Testformulär Text input
Response Formats
"sample string 1"
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">sample string 1</string>