curl "https://connect.maklare.vitec.net/CRM/Contact/StringValue/PresentAccomodation/Statistics?userId=StringValue&dateFrom=2015-01-01T12:00:00&dateTo=2015-01-01T12:00:00" -X GET -H "Authorization: basic {Base64 kodad användarnamn och lösenord}"
Dokumentation för API-funktioner
GET CRM/Contact/{customerId}/PresentAccomodation/Statistics
Hämta statistik gällande lämnarinfo för spekulanter på sålda objekt
Request Information
URI Parameters
Response Information
Resource Description
Hämta statistik gällande lämnarinfo för spekulanter på sålda objekt
CrmPresentAccomodationStatistics
Kodexempel
Testformulär
Text input
Response Formats
Namn | Beskrivning | Typ | Information |
customerId | Kund-id. | string |
Krävs |
userId | Användar-id | string | |
dateFrom | Datum från | date | |
dateTo | Datum till | date |
Namn | Beskrivning | Typ | Information |
Office | Collection of CrmPresentAccomodationStatisticsOffice |
$URL = "https://connect.maklare.vitec.net/CRM/Contact/StringValue/PresentAccomodation/Statistics?userId=StringValue&dateFrom=2015-01-01T12:00:00&dateTo=2015-01-01T12:00:00"
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/PresentAccomodation/Statistics?userId=StringValue&dateFrom=2015-01-01T12:00:00&dateTo=2015-01-01T12:00:00")) {
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 office = result.office.Value ;
// TODO: Gör något med resultatet
}
$URL = "https://connect.maklare.vitec.net/CRM/Contact/StringValue/PresentAccomodation/Statistics?userId=StringValue&dateFrom=2015-01-01T12:00:00&dateTo=2015-01-01T12:00:00";
$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
}
$field_on_result = $result["office"];
// TODO: Gör något med resultatet
Resultat av begäran
{ "office": [ { "customerId": "sample string 1", "name": "sample string 2", "users": [ { "id": "sample string 1", "name": "sample string 2", "estates": 3, "prospectives": [ { "prospectives": 1, "interestLevel": "Reserved" }, { "prospectives": 1, "interestLevel": "Reserved" } ], "showingParticipants": 4, "bidders": 5, "askedProspectives": [ { "prospectives": 1, "interestLevel": "Reserved" }, { "prospectives": 1, "interestLevel": "Reserved" } ], "askedProspectivesOwningAccomodation": [ { "prospectives": 1, "interestLevel": "Reserved" }, { "prospectives": 1, "interestLevel": "Reserved" } ] }, { "id": "sample string 1", "name": "sample string 2", "estates": 3, "prospectives": [ { "prospectives": 1, "interestLevel": "Reserved" }, { "prospectives": 1, "interestLevel": "Reserved" } ], "showingParticipants": 4, "bidders": 5, "askedProspectives": [ { "prospectives": 1, "interestLevel": "Reserved" }, { "prospectives": 1, "interestLevel": "Reserved" } ], "askedProspectivesOwningAccomodation": [ { "prospectives": 1, "interestLevel": "Reserved" }, { "prospectives": 1, "interestLevel": "Reserved" } ] } ] }, { "customerId": "sample string 1", "name": "sample string 2", "users": [ { "id": "sample string 1", "name": "sample string 2", "estates": 3, "prospectives": [ { "prospectives": 1, "interestLevel": "Reserved" }, { "prospectives": 1, "interestLevel": "Reserved" } ], "showingParticipants": 4, "bidders": 5, "askedProspectives": [ { "prospectives": 1, "interestLevel": "Reserved" }, { "prospectives": 1, "interestLevel": "Reserved" } ], "askedProspectivesOwningAccomodation": [ { "prospectives": 1, "interestLevel": "Reserved" }, { "prospectives": 1, "interestLevel": "Reserved" } ] }, { "id": "sample string 1", "name": "sample string 2", "estates": 3, "prospectives": [ { "prospectives": 1, "interestLevel": "Reserved" }, { "prospectives": 1, "interestLevel": "Reserved" } ], "showingParticipants": 4, "bidders": 5, "askedProspectives": [ { "prospectives": 1, "interestLevel": "Reserved" }, { "prospectives": 1, "interestLevel": "Reserved" } ], "askedProspectivesOwningAccomodation": [ { "prospectives": 1, "interestLevel": "Reserved" }, { "prospectives": 1, "interestLevel": "Reserved" } ] } ] } ] }
<CrmPresentAccomodationStatistics xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models.Contact.Crm"> <Office> <CrmPresentAccomodationStatisticsOffice> <CustomerId>sample string 1</CustomerId> <Name>sample string 2</Name> <Users> <CrmPresentAccomodationStatisticsUser> <AskedProspectives> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> </AskedProspectives> <AskedProspectivesOwningAccomodation> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> </AskedProspectivesOwningAccomodation> <Bidders>5</Bidders> <Estates>3</Estates> <Id>sample string 1</Id> <Name>sample string 2</Name> <Prospectives> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> </Prospectives> <ShowingParticipants>4</ShowingParticipants> </CrmPresentAccomodationStatisticsUser> <CrmPresentAccomodationStatisticsUser> <AskedProspectives> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> </AskedProspectives> <AskedProspectivesOwningAccomodation> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> </AskedProspectivesOwningAccomodation> <Bidders>5</Bidders> <Estates>3</Estates> <Id>sample string 1</Id> <Name>sample string 2</Name> <Prospectives> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> </Prospectives> <ShowingParticipants>4</ShowingParticipants> </CrmPresentAccomodationStatisticsUser> </Users> </CrmPresentAccomodationStatisticsOffice> <CrmPresentAccomodationStatisticsOffice> <CustomerId>sample string 1</CustomerId> <Name>sample string 2</Name> <Users> <CrmPresentAccomodationStatisticsUser> <AskedProspectives> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> </AskedProspectives> <AskedProspectivesOwningAccomodation> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> </AskedProspectivesOwningAccomodation> <Bidders>5</Bidders> <Estates>3</Estates> <Id>sample string 1</Id> <Name>sample string 2</Name> <Prospectives> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> </Prospectives> <ShowingParticipants>4</ShowingParticipants> </CrmPresentAccomodationStatisticsUser> <CrmPresentAccomodationStatisticsUser> <AskedProspectives> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> </AskedProspectives> <AskedProspectivesOwningAccomodation> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> </AskedProspectivesOwningAccomodation> <Bidders>5</Bidders> <Estates>3</Estates> <Id>sample string 1</Id> <Name>sample string 2</Name> <Prospectives> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> <CrmPresentAccomodationStatisticsGroup> <InterestLevel>Reserved</InterestLevel> <Prospectives>1</Prospectives> </CrmPresentAccomodationStatisticsGroup> </Prospectives> <ShowingParticipants>4</ShowingParticipants> </CrmPresentAccomodationStatisticsUser> </Users> </CrmPresentAccomodationStatisticsOffice> </Office> </CrmPresentAccomodationStatistics>