Dokumentation för API-funktioner
GET CRM/Contact/{customerId}/{contactId}/{objectLeadType}/{contactLeadType}/{logLeadType}/{outgoingLeadType}/Lead Hämta info om leads för en kontakt. Request Information URI Parameters
NamnBeskrivningTypInformation
customerId Kund-id. string Krävs
contactId Kontaktid. string Krävs
objectLeadType ObjectLeadType. boolean Krävs
contactLeadType ContactLeadType. boolean Krävs
logLeadType LogLeadType. boolean Krävs
outgoingLeadType OutgoingLeadType. boolean Krävs
Response Information Resource Description Hämta info om leads för en kontakt. CrmContactLead
NamnBeskrivningTypInformation
ContactId KontaktId string

Leads Lista med info om leads Collection of CrmLead

Kodexempel

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

$URL = "https://connect.maklare.vitec.net/CRM/Contact/StringValue/StringValue/False/False/False/False/Lead"
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/StringValue/False/False/False/False/Lead")) {
    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 contactId = result.contactId.Value;
    // TODO: Gör något med resultatet
}

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

$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["contactId"];
// TODO: Gör något med resultatet
Testformulär Text input
Response Formats
{
  "contactId": "sample string 1",
  "leads": [
    {
      "id": "sample string 1",
      "createdAt": "2024-05-03T04:23:05.6210673+02:00",
      "leadType": "Object",
      "leadTypeId": "sample string 3"
    },
    {
      "id": "sample string 1",
      "createdAt": "2024-05-03T04:23:05.6210673+02:00",
      "leadType": "Object",
      "leadTypeId": "sample string 3"
    }
  ]
}
<CrmContactLead xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models.Contact.Crm">
  <ContactId>sample string 1</ContactId>
  <Leads>
    <CrmLead>
      <CreatedAt>2024-05-03T04:23:05.6210673+02:00</CreatedAt>
      <Id>sample string 1</Id>
      <LeadType>Object</LeadType>
      <LeadTypeId>sample string 3</LeadTypeId>
    </CrmLead>
    <CrmLead>
      <CreatedAt>2024-05-03T04:23:05.6210673+02:00</CreatedAt>
      <Id>sample string 1</Id>
      <LeadType>Object</LeadType>
      <LeadTypeId>sample string 3</LeadTypeId>
    </CrmLead>
  </Leads>
</CrmContactLead>