{ "baseInformation": { "status": "Coming", "projectName": "sample string 1", "saleStart": "2024-11-21T09:46:10.8184993+01:00", "preliminaryAccess": "sample string 2", "producer": "sample string 3", "address": { "municipality": "sample string 1", "coordinate": { "longitud": 1.1, "latitud": 2.1 }, "streetAddress": "sample string 2", "zipCode": "sample string 3", "city": "sample string 4", "countryCode": "sample string 5" } }, "sellingHeading": "sample string 1", "longSellingDescription": "sample string 2" }
Dokumentation för API-funktioner
PUT CRM/Project/{customerId}/{projectId}
Metod för att uppdatera ett projekt
Request Information
URI Parameters
Body Parameters
Projektinformationen som ska uppdateras CmsProject
Response Information
Resource Description
Metod för att uppdatera ett projekt
Kodexempel
Testformulär
Text input
Namn | Beskrivning | Typ | Information |
customerId | Kundid | string |
Krävs |
projectId | Id på projektet | string |
Krävs |
Namn | Beskrivning | Typ | Information |
BaseInformation | Grundinformation om projektet | CmsProjectBaseInformation | |
SellingHeading | Säljande rubrik på projektet | string | |
LongSellingDescription | Lång beskrivning av projektet | string |
Request Formats
<CmsProject xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms"> <BaseInformation> <Address xmlns:d3p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms.Common"> <City xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models">sample string 4</City> <CountryCode xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models">sample string 5</CountryCode> <StreetAddress xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models">sample string 2</StreetAddress> <ZipCode xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models">sample string 3</ZipCode> <d3p1:Coordinate xmlns:d4p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models"> <d4p1:Latitud>2.1</d4p1:Latitud> <d4p1:Longitud>1.1</d4p1:Longitud> </d3p1:Coordinate> <d3p1:Municipality>sample string 1</d3p1:Municipality> </Address> <PreliminaryAccess>sample string 2</PreliminaryAccess> <Producer>sample string 3</Producer> <ProjectName>sample string 1</ProjectName> <SaleStart>2024-11-21T09:46:10.8184993+01:00</SaleStart> <Status>Coming</Status> </BaseInformation> <LongSellingDescription>sample string 2</LongSellingDescription> <SellingHeading>sample string 1</SellingHeading> </CmsProject>
curl "https://connect.maklare.vitec.net/CRM/Project/StringValue/StringValue" -X PUT -H "Content-Type: application/json" -H "Authorization: basic {Base64 kodad användarnamn och lösenord}" -d {\"baseInformation\":{\"status\":0,\"projectName\":\"StringValue\",\"saleStart\":\"2015-01-01T12:00:00\"},\"sellingHeading\":\"StringValue\",\"longSellingDescription\":\"StringValue\"}
$URL = "https://connect.maklare.vitec.net/CRM/Project/StringValue/StringValue"
$data = "{`"baseInformation`":{`"status`":0,`"projectName`":`"StringValue`",`"saleStart`":`"2015-01-01T12:00:00`"},`"sellingHeading`":`"StringValue`",`"longSellingDescription`":`"StringValue`"}"
Invoke-WebRequest -Uri $URL -Method PUT -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 = "{\"baseInformation\":{\"status\":0,\"projectName\":\"StringValue\",\"saleStart\":\"2015-01-01T12:00:00\"},\"sellingHeading\":\"StringValue\",\"longSellingDescription\":\"StringValue\"}";
using (var response = await HttpClientInstance.PutAsync("CRM/Project/StringValue/StringValue", 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
}
}
$URL = "https://connect.maklare.vitec.net/CRM/Project/StringValue/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);
$data = "{\"baseInformation\":{\"status\":0,\"projectName\":\"StringValue\",\"saleStart\":\"2015-01-01T12:00:00\"},\"sellingHeading\":\"StringValue\",\"longSellingDescription\":\"StringValue\"}";
$headers = array( "Content-Type: application/json", "Content-Length: " . strlen($data) );
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
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
}
Resultat av begäran