Dokumentation för API-funktioner
GET CRM/Office/{customerId}/Sub/{subOfficeIds} Hämta flera underkontor Request Information URI Parameters
NamnBeskrivningTypInformation
customerId Kund-id string Krävs
subOfficeIds Underkontorens idn string Krävs
Response Information Resource Description Hämta flera underkontor Collection of CrmSubOffice
NamnBeskrivningTypInformation
CustomerId Kundid string

Id Officeid string

Name string

LegalName 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

CorporateNumber Organisationsnummer string

Bankgiro Bankgiro string

Postalgiro Plusgiro string

DateChanged Ändringsdatum date

Kodexempel

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

$URL = "https://connect.maklare.vitec.net/CRM/Office/StringValue/Sub/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("CRM/Office/StringValue/Sub/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 customerId = firstInArray.customerId.Value;
    // TODO: Gör något med resultatet
}

$URL = "https://connect.maklare.vitec.net/CRM/Office/StringValue/Sub/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["customerId"];
// TODO: Gör något med resultatet
Testformulär Text input
Response Formats
[
  {
    "customerId": "sample string 1",
    "id": "sample string 2",
    "name": "sample string 3",
    "legalName": "sample string 4",
    "address": "sample string 5",
    "postalAddress": "sample string 6",
    "zipCode": "sample string 7",
    "city": "sample string 8",
    "telephone": "sample string 9",
    "companyPlace": "sample string 10",
    "emailAddress": "sample string 11",
    "homePage": "sample string 12",
    "corporateNumber": "sample string 13",
    "bankgiro": "sample string 14",
    "postalgiro": "sample string 15",
    "dateChanged": "2024-11-21T10:12:26.6587765+01:00"
  },
  {
    "customerId": "sample string 1",
    "id": "sample string 2",
    "name": "sample string 3",
    "legalName": "sample string 4",
    "address": "sample string 5",
    "postalAddress": "sample string 6",
    "zipCode": "sample string 7",
    "city": "sample string 8",
    "telephone": "sample string 9",
    "companyPlace": "sample string 10",
    "emailAddress": "sample string 11",
    "homePage": "sample string 12",
    "corporateNumber": "sample string 13",
    "bankgiro": "sample string 14",
    "postalgiro": "sample string 15",
    "dateChanged": "2024-11-21T10:12:26.6587765+01:00"
  }
]
<ArrayOfCrmSubOffice xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models.CrmOffice">
  <CrmSubOffice>
    <Address>sample string 5</Address>
    <Bankgiro>sample string 14</Bankgiro>
    <City>sample string 8</City>
    <CompanyPlace>sample string 10</CompanyPlace>
    <CorporateNumber>sample string 13</CorporateNumber>
    <CustomerId>sample string 1</CustomerId>
    <DateChanged>2024-11-21T10:12:26.6587765+01:00</DateChanged>
    <EmailAddress>sample string 11</EmailAddress>
    <HomePage>sample string 12</HomePage>
    <Id>sample string 2</Id>
    <LegalName>sample string 4</LegalName>
    <Name>sample string 3</Name>
    <PostalAddress>sample string 6</PostalAddress>
    <Postalgiro>sample string 15</Postalgiro>
    <Telephone>sample string 9</Telephone>
    <ZipCode>sample string 7</ZipCode>
  </CrmSubOffice>
  <CrmSubOffice>
    <Address>sample string 5</Address>
    <Bankgiro>sample string 14</Bankgiro>
    <City>sample string 8</City>
    <CompanyPlace>sample string 10</CompanyPlace>
    <CorporateNumber>sample string 13</CorporateNumber>
    <CustomerId>sample string 1</CustomerId>
    <DateChanged>2024-11-21T10:12:26.6587765+01:00</DateChanged>
    <EmailAddress>sample string 11</EmailAddress>
    <HomePage>sample string 12</HomePage>
    <Id>sample string 2</Id>
    <LegalName>sample string 4</LegalName>
    <Name>sample string 3</Name>
    <PostalAddress>sample string 6</PostalAddress>
    <Postalgiro>sample string 15</Postalgiro>
    <Telephone>sample string 9</Telephone>
    <ZipCode>sample string 7</ZipCode>
  </CrmSubOffice>
</ArrayOfCrmSubOffice>