Dokumentation för API-funktioner
GET Advertising/Area/{customerId}/{areaId}

Hämta område för hemsida.

Request Information URI Parameters
NamnBeskrivningTypInformation
customerId Kund-id string Krävs
areaId Områdesid string Krävs
Response Information Resource Description

Hämta område för hemsida.

AdvertisingArea
NamnBeskrivningTypInformation
Id Id string

Name Namn string

CountyMunicipalityCode LKF kod string

Coordinates Områdets koordinater i formatet GeoJSON Multipolygon (longitud, latitud) Collection of Collection of Collection of Collection of decimal number

ChangedAt När området senast ändrades date

Office Kontor AdvertisingOfficeReference

Surroundings Närområde AdvertisingSurroundings

Images Bilder Collection of AdvertisingImage

Kodexempel

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

$URL = "https://connect.maklare.vitec.net/Advertising/Area/StringValue/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("Advertising/Area/StringValue/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 id = result.id.Value;
    // TODO: Gör något med resultatet
}

$URL = "https://connect.maklare.vitec.net/Advertising/Area/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);

$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["id"];
// TODO: Gör något med resultatet
Testformulär Text input
Response Formats
{
  "id": "sample string 1",
  "name": "sample string 2",
  "countyMunicipalityCode": "sample string 3",
  "coordinates": [
    [
      [
        [
          1.1,
          2.1
        ],
        [
          1.1,
          2.1
        ]
      ],
      [
        [
          1.1,
          2.1
        ],
        [
          1.1,
          2.1
        ]
      ]
    ],
    [
      [
        [
          1.1,
          2.1
        ],
        [
          1.1,
          2.1
        ]
      ],
      [
        [
          1.1,
          2.1
        ],
        [
          1.1,
          2.1
        ]
      ]
    ]
  ],
  "changedAt": "2025-04-04T15:35:43.063441+02:00",
  "office": {
    "id": "sample string 1",
    "customerId": "sample string 2"
  },
  "surroundings": {
    "service": "sample string 1",
    "communication": "sample string 2",
    "area": "sample string 3",
    "parking": "sample string 4",
    "other": "sample string 5"
  },
  "images": [
    {
      "id": "sample string 1",
      "dataChangedAt": "2025-04-04T15:35:43.063441+02:00",
      "description": "sample string 3",
      "name": "sample string 4",
      "category": {
        "id": "sample string 1",
        "name": "sample string 2"
      },
      "extension": "sample string 5",
      "cdnReferences": [
        {
          "name": "sample string 1",
          "url": "sample string 2"
        },
        {
          "name": "sample string 1",
          "url": "sample string 2"
        }
      ]
    },
    {
      "id": "sample string 1",
      "dataChangedAt": "2025-04-04T15:35:43.063441+02:00",
      "description": "sample string 3",
      "name": "sample string 4",
      "category": {
        "id": "sample string 1",
        "name": "sample string 2"
      },
      "extension": "sample string 5",
      "cdnReferences": [
        {
          "name": "sample string 1",
          "url": "sample string 2"
        },
        {
          "name": "sample string 1",
          "url": "sample string 2"
        }
      ]
    }
  ]
}
<AdvertisingArea xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Services.Advertising">
  <ChangedAt>2025-04-04T15:35:43.063441+02:00</ChangedAt>
  <Coordinates xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:ArrayOfArrayOfArrayOfdouble>
      <d2p1:ArrayOfArrayOfdouble>
        <d2p1:ArrayOfdouble>
          <d2p1:double>1.1</d2p1:double>
          <d2p1:double>2.1</d2p1:double>
        </d2p1:ArrayOfdouble>
        <d2p1:ArrayOfdouble>
          <d2p1:double>1.1</d2p1:double>
          <d2p1:double>2.1</d2p1:double>
        </d2p1:ArrayOfdouble>
      </d2p1:ArrayOfArrayOfdouble>
      <d2p1:ArrayOfArrayOfdouble>
        <d2p1:ArrayOfdouble>
          <d2p1:double>1.1</d2p1:double>
          <d2p1:double>2.1</d2p1:double>
        </d2p1:ArrayOfdouble>
        <d2p1:ArrayOfdouble>
          <d2p1:double>1.1</d2p1:double>
          <d2p1:double>2.1</d2p1:double>
        </d2p1:ArrayOfdouble>
      </d2p1:ArrayOfArrayOfdouble>
    </d2p1:ArrayOfArrayOfArrayOfdouble>
    <d2p1:ArrayOfArrayOfArrayOfdouble>
      <d2p1:ArrayOfArrayOfdouble>
        <d2p1:ArrayOfdouble>
          <d2p1:double>1.1</d2p1:double>
          <d2p1:double>2.1</d2p1:double>
        </d2p1:ArrayOfdouble>
        <d2p1:ArrayOfdouble>
          <d2p1:double>1.1</d2p1:double>
          <d2p1:double>2.1</d2p1:double>
        </d2p1:ArrayOfdouble>
      </d2p1:ArrayOfArrayOfdouble>
      <d2p1:ArrayOfArrayOfdouble>
        <d2p1:ArrayOfdouble>
          <d2p1:double>1.1</d2p1:double>
          <d2p1:double>2.1</d2p1:double>
        </d2p1:ArrayOfdouble>
        <d2p1:ArrayOfdouble>
          <d2p1:double>1.1</d2p1:double>
          <d2p1:double>2.1</d2p1:double>
        </d2p1:ArrayOfdouble>
      </d2p1:ArrayOfArrayOfdouble>
    </d2p1:ArrayOfArrayOfArrayOfdouble>
  </Coordinates>
  <CountyMunicipalityCode>sample string 3</CountyMunicipalityCode>
  <Id>sample string 1</Id>
  <Images>
    <AdvertisingImage>
      <Category>
        <Id xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models">sample string 1</Id>
        <Name xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models">sample string 2</Name>
      </Category>
      <CdnReferences xmlns:d4p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api">
        <d4p1:CdnImageReference>
          <d4p1:Name>sample string 1</d4p1:Name>
          <d4p1:Url>sample string 2</d4p1:Url>
        </d4p1:CdnImageReference>
        <d4p1:CdnImageReference>
          <d4p1:Name>sample string 1</d4p1:Name>
          <d4p1:Url>sample string 2</d4p1:Url>
        </d4p1:CdnImageReference>
      </CdnReferences>
      <DataChangedAt>2025-04-04T15:35:43.063441+02:00</DataChangedAt>
      <Description>sample string 3</Description>
      <Extension>sample string 5</Extension>
      <Id>sample string 1</Id>
      <Name>sample string 4</Name>
    </AdvertisingImage>
    <AdvertisingImage>
      <Category>
        <Id xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models">sample string 1</Id>
        <Name xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models">sample string 2</Name>
      </Category>
      <CdnReferences xmlns:d4p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api">
        <d4p1:CdnImageReference>
          <d4p1:Name>sample string 1</d4p1:Name>
          <d4p1:Url>sample string 2</d4p1:Url>
        </d4p1:CdnImageReference>
        <d4p1:CdnImageReference>
          <d4p1:Name>sample string 1</d4p1:Name>
          <d4p1:Url>sample string 2</d4p1:Url>
        </d4p1:CdnImageReference>
      </CdnReferences>
      <DataChangedAt>2025-04-04T15:35:43.063441+02:00</DataChangedAt>
      <Description>sample string 3</Description>
      <Extension>sample string 5</Extension>
      <Id>sample string 1</Id>
      <Name>sample string 4</Name>
    </AdvertisingImage>
  </Images>
  <Name>sample string 2</Name>
  <Office>
    <CustomerId>sample string 2</CustomerId>
    <Id>sample string 1</Id>
  </Office>
  <Surroundings>
    <Area>sample string 3</Area>
    <Communication>sample string 2</Communication>
    <Other>sample string 5</Other>
    <Parking>sample string 4</Parking>
    <Service>sample string 1</Service>
  </Surroundings>
</AdvertisingArea>