MyGate

Sync API

This API is used to sync entity access information from MyGate to Access Devices.

Endpoint

Method: GET

Headers

NameValueNotes
mg-xs-api-keyVEHICLEAccess Entity Type Enum
mg-xs-etypexxxxAPI Key, provided by MyGate
Acceptapplication/json

Sample Request & Response Body

Query Params

NameTypeNotes
device_idStringDevice Identifier which is onboarded at MyGate's end
timestampLongTimestamp defines the records to be returned which have been added/deleted after a particular value
pageLongPage number defines the records in a particular page, every page has 20 records

Initial Sync

Request

curl --location --request GET 'https://gateway.mgthunderbolt.xyz/access/v1/sync?device_id=xxx&timestamp=0&page=0' \
--header 'mg-xs-etype: VEHICLE' \
--header 'mg-xs-api-key: xxxx'

Response

{
"timestamp": "Long",
"all": [
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
},
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
},
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
},
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
},
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
},
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
},
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
},
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
},
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
}
],
"success": "Boolean",
"_links": {
"next": {
"href": "String"
}
}
}

Response Attributes

NameTypeNotes
allList[Object]Initial sync. Only populated when the query timestamp is 0. Same format as upserted
timestampLongTimestamp of last sync.
_linksObjectLink to the next set of results (pagination). Use this to traverse through the complete result set. The last page/set will not have this field and can be used for terminating the traversal
successBooleanIf false, message is populated with the reason
messageStringResponse message
all.access_entity_typeEnumVEHICLE (Refer enum table)
all.access_uuid_typeEnumLPN,TAG etc (Refer enum table)
all.access_uuidStringThe unique identifier associated with the entity seeking access. Can be one of either MD5 hash string of the uuid value or Base64 encoded string of the uuid value used for image based uuid type like face and fingerprint
all.access_ref_idStringThe opaque identifier used to identify the entity in mygate backend. It is passed back in the notify API
all.access_displayStringThe display string to be used (optional)

Incremental Sync

Request

curl --location --request GET 'https://gateway.mgthunderbolt.xyz/access/v1/sync?device_id=xxx&timestamp=1676033513&page=0' \
--header 'mg-xs-etype: VEHICLE' \
--header 'mg-xs-api-key: xxxx'

Response

{
"timestamp": "Long",
"deleted": [
"String",
"String"
],
"upserted": [
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
},
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
},
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
},
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
},
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
},
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
},
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
},
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
},
{
"access_entity_type": "String",
"access_uuid_type": "String",
"access_ref_id": "String",
"access_uuid": "String",
"access_display": "String"
}
],
"success": "Boolean",
"_links": {
"next": {
"href": "String"
}
}
}

Response Attributes

NameTypeNotes
upsertedList[Object]Encoded entries in object form added or updated since timestamp. Same format as all
timestampLongTimestamp of last sync.
_linksObjectLink to the next set of results (pagination). Use this to traverse through the complete result set. The last page/set will not have this field and can be used for terminating the traversal
successBooleanIf false, message is populated with the reason
upserted.access_entity_typeEnumVEHICLE (Refer enum table)
upserted.access_uuid_typeEnumLPN,TAG etc (Refer enum table)
upserted.access_uuidStringThe unique identifier associated with the entity seeking access. Can be one of either MD5 hash string of the uuid value or Base64 encoded string of the uuid value used for image based uuid type like face and fingerprint
upserted.access_ref_idStringThe opaque identifier used to identify the entity in mygate backend. It is passed back in the notify API
upserted.access_displayStringThe display string to be used (optional)
deletedList[String]access_ref_ids deleted since timestamp
Suggestions, contact, support and error reporting: [email protected]