POST api/Geofence/CreateGeofence

Create a new Geofence for a device

Request Information

Body Parameters

geofence model data

GeofenceModel
NameDescriptionTypeAdditional information
Item

Fence information

FenceInfo

None.

MapType

map style

string

None.

Token

Get it after logging in Token

string

None.

Language

Language Option

string

None.

AppId

APP Application Identifier

string

None.

Request Formats

application/json, text/json

Sample:
{
  "Item": {
    "FenceId": 1,
    "DeviceId": 2,
    "FenceName": "sample string 3",
    "Latitude": 4.0,
    "Longitude": 5.0,
    "Radius": 6.0,
    "FenceType": 7,
    "AlarmType": 8,
    "IsDeviceFence": true,
    "AlarmModel": 10,
    "DeviceFenceNo": 11,
    "Description": "sample string 12",
    "IMEIList": [
      "sample string 1",
      "sample string 2"
    ],
    "Points": [
      {
        "Lat": 1.0,
        "Lng": 2.0,
        "SortOrder": 3
      },
      {
        "Lat": 1.0,
        "Lng": 2.0,
        "SortOrder": 3
      }
    ],
    "Address": "sample string 13",
    "InUse": true,
    "StartTime": "sample string 15",
    "EndTime": "sample string 16"
  },
  "MapType": "sample string 1",
  "Token": "sample string 2",
  "Language": "sample string 3",
  "AppId": "sample string 4"
}

application/xml, text/xml

Sample:
<GeofenceModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/NewGPS2012.AppApi.Models.ParModel">
  <AppId>sample string 4</AppId>
  <Language>sample string 3</Language>
  <Token>sample string 2</Token>
  <Item xmlns:d2p1="http://schemas.datacontract.org/2004/07/NewGPS2012.AppApi.Models.ViewModel">
    <d2p1:Address>sample string 13</d2p1:Address>
    <d2p1:AlarmModel>10</d2p1:AlarmModel>
    <d2p1:AlarmType>8</d2p1:AlarmType>
    <d2p1:Description>sample string 12</d2p1:Description>
    <d2p1:DeviceFenceNo>11</d2p1:DeviceFenceNo>
    <d2p1:DeviceId>2</d2p1:DeviceId>
    <d2p1:EndTime>sample string 16</d2p1:EndTime>
    <d2p1:FenceId>1</d2p1:FenceId>
    <d2p1:FenceName>sample string 3</d2p1:FenceName>
    <d2p1:FenceType>7</d2p1:FenceType>
    <d2p1:IMEIList xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:string>sample string 1</d3p1:string>
      <d3p1:string>sample string 2</d3p1:string>
    </d2p1:IMEIList>
    <d2p1:InUse>true</d2p1:InUse>
    <d2p1:IsDeviceFence>true</d2p1:IsDeviceFence>
    <d2p1:Latitude>4</d2p1:Latitude>
    <d2p1:Longitude>5</d2p1:Longitude>
    <d2p1:Points>
      <d2p1:Point>
        <d2p1:Lat>1</d2p1:Lat>
        <d2p1:Lng>2</d2p1:Lng>
        <d2p1:SortOrder>3</d2p1:SortOrder>
      </d2p1:Point>
      <d2p1:Point>
        <d2p1:Lat>1</d2p1:Lat>
        <d2p1:Lng>2</d2p1:Lng>
        <d2p1:SortOrder>3</d2p1:SortOrder>
      </d2p1:Point>
    </d2p1:Points>
    <d2p1:Radius>6</d2p1:Radius>
    <d2p1:StartTime>sample string 15</d2p1:StartTime>
  </Item>
  <MapType>sample string 1</MapType>
</GeofenceModel>

Response Information

Resource Description

result, for example
State:
0. Success
1100. device not exist
4000. Fail
4003. The number of fences reached the maximum limit [just for device fence]

CreateGeofenceResult
NameDescriptionTypeAdditional information
Message

string

None.

State

status code

integer

None.

Response Formats

application/json, text/json

Sample:
{
  "Message": "sample string 1",
  "State": 2
}

application/xml, text/xml

Sample:
<CreateGeofenceResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/NewGPS2012.AppApi.Models.ResModel">
  <State>2</State>
  <Message>sample string 1</Message>
</CreateGeofenceResult>