12. TrakIT API‎ > ‎Asset‎ > ‎

Link/Unlink Assets

The below API is used to link an asset to another asset. Linking or un-linking can be performed using the Asset ID or the Asset Serials.

Request: POST

Signature: /api/mobile/LinkAsset

Body: 

"Token":"Token",
"AssetID":AssetID_To_Link,
"LinkTo":AssetID_To_Link_To,
"Replace":Replace_or_not

or

"Token":"Token",
"AssetSerial":"AssetSerial_To_Link",
"LinkToSerial":"AssetSerial_To_Link_To",
"Replace":Replace_or_not


Sample: /api/mobile/LinkAsset
Body: 

"Token":"VomYEMiECFFyAQ3==",
"AssetID":123,
"LinkTo":234, 
"Replace": true

or 

"Token":"VomYEMiECFFyAQ3==",
"AssetSerial":"XYZ1234",
"LinkToSerial":"ABC4567", 
"Replace": true


Response:

{
"Code": 1,
"Info": "Asset linked successfully",
"RowsAffected": 1,
"Scalar": null,
"Identity": 0,
"RetInfo": null
}


Things to know about this API: 
  1. Token - You can use Login API to get token displayed under Info

  2. These fields are mandatory while sending request body: 

    • AssetID or AssetSerial - The ID or Serial of the asset being linked
    • LinkTo or LinkToSerial - The ID or Serial of the asset to which the first asset is linked
    • Replace - Whether to replace any existing linked assets of the same type
      

The below API is used to unlink an asset that is linked to another.


Request: POST 

Signature: /api/mobile/UnlinkAsset

Body: 

"Token":"Token",
"AssetID":AssetID_To_Unlink

or

"Token":"Token",
"AssetSerial":"AssetSerial_To_Unlink"

Sample: /api/mobile/UnlinkAsset
Body: 

"Token":"VomYEMiECFFyAQ3==",
"AssetID":123
}

or

"Token":"VomYEMiECFFyAQ3==",
"AssetSerial":"XYZ1234"
}


Response:


"Code": 1,
"Info": "Asset unlinked successfully",
"RowsAffected": 1,
"Scalar": null,
"Identity": 0,
"RetInfo": null
}


Things to know about this API: 
  1. Token - You can use Login API to get token displayed under Info

  2. These fields are mandatory while sending request body: 

    • AssetID or AssetSerial - The ID or the Serial of the asset being unlinked
Comments