curl "https://connect.maklare.vitec.net/CRM/Contact/StringValue/Company/StringValue" -X GET -H "Authorization: basic {Base64 kodad användarnamn och lösenord}"
Dokumentation för API-funktioner
GET CRM/Contact/{customerId}/Company/{contactIds}
Hämta lista utav företagskontakter, max 20 stycken åt gången.
Request Information
URI Parameters
Response Information
Resource Description
Hämta lista utav företagskontakter, max 20 stycken åt gången.
Collection of CrmCompanyContact
Kodexempel
Testformulär
Text input
Response Formats
Namn | Beskrivning | Typ | Information |
customerId | Kund-id. | string |
Krävs |
contactIds | Kontaktidn (kommaseparerade, max 20 stycken). | string |
Krävs |
Namn | Beskrivning | Typ | Information |
Type | Kontakttyp (Person, företag eller dödsbo) | ContactType | |
Name | Företagsnamn | string |
Företagsnamn måste vara mellan 0 och 50 tecken |
CorporateNumber | Organisationsnummer | string |
Organisationsnummer måste vara mellan 0 och 20 tecken |
IsForeignCorporateNumber | Annat format/utländskt organisationsnummer | boolean | |
HomePage | Hemsida | string |
Hemsida måste vara mellan 0 och 60 tecken |
Telephone | Telefonnummer | CompanyTelephoneNumbers | |
LeadScore | Antal lead score stjärnor | integer | |
Id | Kontakt id | string |
Kontaktid måste vara mellan 0 och 40 tecken |
CustomerId | Kund-id | string |
Kund-id krävs Kund-id måste vara mellan 0 och 40 tecken |
AgentId | Mäklarens id | string | |
Address | Adress | CrmContactAddress | |
AdvertisingEnabled | Reklamutskick tillåts | boolean | |
Note | Anteckning | string | |
Categories | Kategorier | Collection of Category | |
CreatedAt | Skapad | date | |
ChangedAt | Ändrad | date |
$URL = "https://connect.maklare.vitec.net/CRM/Contact/StringValue/Company/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/Contact/StringValue/Company/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 type = firstInArray.type.Value ;
// TODO: Gör något med resultatet
}
$URL = "https://connect.maklare.vitec.net/CRM/Contact/StringValue/Company/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["type"];
// TODO: Gör något med resultatet
Resultat av begäran
[ { "type": "Company", "name": "sample string 1", "corporateNumber": "sample string 2", "isForeignCorporateNumber": true, "homePage": "sample string 3", "telephone": { "switch": "sample string 1", "other": "sample string 2" }, "leadScore": 4, "id": "sample string 5", "customerId": "sample string 6", "agentId": "sample string 7", "address": { "streetAddress": "sample string 1", "zipCode": "sample string 2", "city": "sample string 3", "countryCode": "sample string 4" }, "email": { "emailAddress": "sample string 1", "emailAddress2": "sample string 2" }, "advertisingEnabled": true, "note": "sample string 9", "categories": [ { "id": "sample string 1", "name": "sample string 2", "readOnly": true }, { "id": "sample string 1", "name": "sample string 2", "readOnly": true } ], "createdAt": "2024-11-21T12:25:36.5362719+01:00", "changedAt": "2024-11-21T12:25:36.5362719+01:00" }, { "type": "Company", "name": "sample string 1", "corporateNumber": "sample string 2", "isForeignCorporateNumber": true, "homePage": "sample string 3", "telephone": { "switch": "sample string 1", "other": "sample string 2" }, "leadScore": 4, "id": "sample string 5", "customerId": "sample string 6", "agentId": "sample string 7", "address": { "streetAddress": "sample string 1", "zipCode": "sample string 2", "city": "sample string 3", "countryCode": "sample string 4" }, "email": { "emailAddress": "sample string 1", "emailAddress2": "sample string 2" }, "advertisingEnabled": true, "note": "sample string 9", "categories": [ { "id": "sample string 1", "name": "sample string 2", "readOnly": true }, { "id": "sample string 1", "name": "sample string 2", "readOnly": true } ], "createdAt": "2024-11-21T12:25:36.5362719+01:00", "changedAt": "2024-11-21T12:25:36.5362719+01:00" } ]
<ArrayOfCrmCompanyContact xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Contact.Crm"> <CrmCompanyContact> <Address> <City>sample string 3</City> <CountryCode>sample string 4</CountryCode> <StreetAddress>sample string 1</StreetAddress> <ZipCode>sample string 2</ZipCode> </Address> <AdvertisingEnabled>true</AdvertisingEnabled> <AgentId>sample string 7</AgentId> <Categories xmlns:d3p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Category"> <d3p1:Category> <d3p1:Id>sample string 1</d3p1:Id> <d3p1:Name>sample string 2</d3p1:Name> <d3p1:ReadOnly>true</d3p1:ReadOnly> </d3p1:Category> <d3p1:Category> <d3p1:Id>sample string 1</d3p1:Id> <d3p1:Name>sample string 2</d3p1:Name> <d3p1:ReadOnly>true</d3p1:ReadOnly> </d3p1:Category> </Categories> <ChangedAt>2024-11-21T12:25:36.5362719+01:00</ChangedAt> <CreatedAt>2024-11-21T12:25:36.5362719+01:00</CreatedAt> <CustomerId>sample string 6</CustomerId> <Email xmlns:d3p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models"> <d3p1:EmailAddress>sample string 1</d3p1:EmailAddress> <d3p1:EmailAddress2>sample string 2</d3p1:EmailAddress2> </Email> <Id>sample string 5</Id> <Note>sample string 9</Note> <Type>Company</Type> <CorporateNumber>sample string 2</CorporateNumber> <HomePage>sample string 3</HomePage> <IsForeignCorporateNumber>true</IsForeignCorporateNumber> <LeadScore>4</LeadScore> <Name>sample string 1</Name> <Telephone> <Other>sample string 2</Other> <Switch>sample string 1</Switch> </Telephone> </CrmCompanyContact> <CrmCompanyContact> <Address> <City>sample string 3</City> <CountryCode>sample string 4</CountryCode> <StreetAddress>sample string 1</StreetAddress> <ZipCode>sample string 2</ZipCode> </Address> <AdvertisingEnabled>true</AdvertisingEnabled> <AgentId>sample string 7</AgentId> <Categories xmlns:d3p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Category"> <d3p1:Category> <d3p1:Id>sample string 1</d3p1:Id> <d3p1:Name>sample string 2</d3p1:Name> <d3p1:ReadOnly>true</d3p1:ReadOnly> </d3p1:Category> <d3p1:Category> <d3p1:Id>sample string 1</d3p1:Id> <d3p1:Name>sample string 2</d3p1:Name> <d3p1:ReadOnly>true</d3p1:ReadOnly> </d3p1:Category> </Categories> <ChangedAt>2024-11-21T12:25:36.5362719+01:00</ChangedAt> <CreatedAt>2024-11-21T12:25:36.5362719+01:00</CreatedAt> <CustomerId>sample string 6</CustomerId> <Email xmlns:d3p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models"> <d3p1:EmailAddress>sample string 1</d3p1:EmailAddress> <d3p1:EmailAddress2>sample string 2</d3p1:EmailAddress2> </Email> <Id>sample string 5</Id> <Note>sample string 9</Note> <Type>Company</Type> <CorporateNumber>sample string 2</CorporateNumber> <HomePage>sample string 3</HomePage> <IsForeignCorporateNumber>true</IsForeignCorporateNumber> <LeadScore>4</LeadScore> <Name>sample string 1</Name> <Telephone> <Other>sample string 2</Other> <Switch>sample string 1</Switch> </Telephone> </CrmCompanyContact> </ArrayOfCrmCompanyContact>