orgsAssets := client.OrgsAssets()
OrgsAssets
Create Org Asset
CreateOrgAsset(
ctx context.Context,
orgId uuid.UUID,
body *models.Asset) (
models.ApiResponse[models.Asset],
error)
Parameter | Type | Tags | Description |
---|---|---|---|
orgId |
uuid.UUID |
Template, Required | - |
body |
*models.Asset |
Body, Optional | Request Body |
ctx := context.Background()
orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")
body := models.Asset{
Mac: "mac0",
Name: "name6",
}
apiResponse, err := orgsAssets.CreateOrgAsset(ctx, orgId, &body)
if err != nil {
log.Fatalln(err)
} else {
// Printing the result and response
fmt.Println(apiResponse.Data)
fmt.Println(apiResponse.Response.StatusCode)
}
{
"created_time": 0,
"id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
"mac": "string",
"map_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
"modified_time": 0,
"name": "string",
"org_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
"site_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
"tag_id": "6f4bf402-45f9-2a56-6c8b-7f83d3bc98e9"
}
HTTP Status Code | Error Description | Exception Class |
---|---|---|
400 | Bad Syntax | ResponseHttp400Exception |
401 | Unauthorized | ResponseHttp401ErrorException |
403 | Permission Denied | ResponseHttp403ErrorException |
404 | Not found. The API endpoint doesn’t exist or resource doesn’ t exist | ResponseHttp404Exception |
429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | ResponseHttp429ErrorException |
Delete Org Asset
DeleteOrgAsset(
ctx context.Context,
orgId uuid.UUID,
assetId uuid.UUID) (
http.Response,
error)
Parameter | Type | Tags | Description |
---|---|---|---|
orgId |
uuid.UUID |
Template, Required | - |
assetId |
uuid.UUID |
Template, Required | - |
``
ctx := context.Background()
orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")
assetId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")
resp, err := orgsAssets.DeleteOrgAsset(ctx, orgId, assetId)
if err != nil {
log.Fatalln(err)
} else {
fmt.Println(resp.StatusCode)
}
HTTP Status Code | Error Description | Exception Class |
---|---|---|
400 | Bad Syntax | ResponseHttp400Exception |
401 | Unauthorized | ResponseHttp401ErrorException |
403 | Permission Denied | ResponseHttp403ErrorException |
404 | Not found. The API endpoint doesn’t exist or resource doesn’ t exist | ResponseHttp404Exception |
429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | ResponseHttp429ErrorException |
Get Org Asset Details
GetOrgAsset(
ctx context.Context,
orgId uuid.UUID,
assetId uuid.UUID) (
models.ApiResponse[models.Asset],
error)
Parameter | Type | Tags | Description |
---|---|---|---|
orgId |
uuid.UUID |
Template, Required | - |
assetId |
uuid.UUID |
Template, Required | - |
ctx := context.Background()
orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")
assetId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")
apiResponse, err := orgsAssets.GetOrgAsset(ctx, orgId, assetId)
if err != nil {
log.Fatalln(err)
} else {
// Printing the result and response
fmt.Println(apiResponse.Data)
fmt.Println(apiResponse.Response.StatusCode)
}
{
"created_time": 0,
"id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
"mac": "string",
"map_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
"modified_time": 0,
"name": "string",
"org_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
"site_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
"tag_id": "6f4bf402-45f9-2a56-6c8b-7f83d3bc98e9"
}
HTTP Status Code | Error Description | Exception Class |
---|---|---|
400 | Bad Syntax | ResponseHttp400Exception |
401 | Unauthorized | ResponseHttp401ErrorException |
403 | Permission Denied | ResponseHttp403ErrorException |
404 | Not found. The API endpoint doesn’t exist or resource doesn’ t exist | ResponseHttp404Exception |
429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | ResponseHttp429ErrorException |
Impert Org Assets.
It can be done via a CSV file or a JSON payload.
name,mac
"asset_name",5c5b53010101
ImportOrgAssets(
ctx context.Context,
orgId uuid.UUID,
file *models.FileWrapper) (
http.Response,
error)
Parameter | Type | Tags | Description |
---|---|---|---|
orgId |
uuid.UUID |
Template, Required | - |
file |
*models.FileWrapper |
Form, Optional | CSV file |
``
ctx := context.Background()
orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")
resp, err := orgsAssets.ImportOrgAssets(ctx, orgId, nil)
if err != nil {
log.Fatalln(err)
} else {
fmt.Println(resp.StatusCode)
}
HTTP Status Code | Error Description | Exception Class |
---|---|---|
400 | Bad Syntax | ResponseHttp400Exception |
401 | Unauthorized | ResponseHttp401ErrorException |
403 | Permission Denied | ResponseHttp403ErrorException |
404 | Not found. The API endpoint doesn’t exist or resource doesn’ t exist | ResponseHttp404Exception |
429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | ResponseHttp429ErrorException |
Get List of Org Assets
ListOrgAssets(
ctx context.Context,
orgId uuid.UUID,
limit *int,
page *int) (
models.ApiResponse[[]models.Asset],
error)
Parameter | Type | Tags | Description |
---|---|---|---|
orgId |
uuid.UUID |
Template, Required | - |
limit |
*int |
Query, Optional | Default: 100 Constraints: >= 0 |
page |
*int |
Query, Optional | Default: 1 Constraints: >= 1 |
ctx := context.Background()
orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")
limit := 100
page := 1
apiResponse, err := orgsAssets.ListOrgAssets(ctx, orgId, &limit, &page)
if err != nil {
log.Fatalln(err)
} else {
// Printing the result and response
fmt.Println(apiResponse.Data)
fmt.Println(apiResponse.Response.StatusCode)
}
HTTP Status Code | Error Description | Exception Class |
---|---|---|
400 | Bad Syntax | ResponseHttp400Exception |
401 | Unauthorized | ResponseHttp401ErrorException |
403 | Permission Denied | ResponseHttp403ErrorException |
404 | Not found. The API endpoint doesn’t exist or resource doesn’ t exist | ResponseHttp404Exception |
429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | ResponseHttp429ErrorException |
Update Org Asset
UpdateOrgAsset(
ctx context.Context,
orgId uuid.UUID,
assetId uuid.UUID,
body *models.Asset) (
models.ApiResponse[models.Asset],
error)
Parameter | Type | Tags | Description |
---|---|---|---|
orgId |
uuid.UUID |
Template, Required | - |
assetId |
uuid.UUID |
Template, Required | - |
body |
*models.Asset |
Body, Optional | Request Body |
ctx := context.Background()
orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")
assetId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")
body := models.Asset{
Mac: "mac0",
Name: "name6",
}
apiResponse, err := orgsAssets.UpdateOrgAsset(ctx, orgId, assetId, &body)
if err != nil {
log.Fatalln(err)
} else {
// Printing the result and response
fmt.Println(apiResponse.Data)
fmt.Println(apiResponse.Response.StatusCode)
}
{
"created_time": 0,
"id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
"mac": "string",
"map_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
"modified_time": 0,
"name": "string",
"org_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
"site_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
"tag_id": "6f4bf402-45f9-2a56-6c8b-7f83d3bc98e9"
}
HTTP Status Code | Error Description | Exception Class |
---|---|---|
400 | Bad Syntax | ResponseHttp400Exception |
401 | Unauthorized | ResponseHttp401ErrorException |
403 | Permission Denied | ResponseHttp403ErrorException |
404 | Not found. The API endpoint doesn’t exist or resource doesn’ t exist | ResponseHttp404Exception |
429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | ResponseHttp429ErrorException |