# Update Thing Name

Please note that in order to update Thing description we will need to run 2 API commands:

[1. Get Thing cas value](#1st-api-command-get-thing-cas-value)

[2. Update Thing Information](#2nd-api-command-update-thing-information)

## 1st API command - get Thing cas value

## Get Thing information

<mark style="color:blue;">`GET`</mark> `https://console.monogoto.io/thing/ThingId_ICCID_{ICCID}`

#### Path Parameters

| Name                                    | Type   | Description           |
| --------------------------------------- | ------ | --------------------- |
| ICCID<mark style="color:red;">\*</mark> | String | The ICCID of your SIM |

#### Headers

| Name                                          | Type   | Description               |
| --------------------------------------------- | ------ | ------------------------- |
| YOUR\_TOKEN<mark style="color:red;">\*</mark> | String | Your authentication token |

{% tabs %}
{% tab title="200: OK OK" %}

```javascript
{
  "Type": "string",
  "PricePlanInnerId": "string",
  "ThingId": "string",
  "CustomerId": "string",
  "ThingName": "string",
  "ThingDescription": "string",
  "ThingsGroupId": "string",
  "ExternalUniqueId": "string",
  "ExternalUniqueType": "string",
  "ExternalBatchId": "string",
  "BatchId": "string",
  "SubProfId": "string",
  "NetworkProviderId": "string",
  "RoamingPolicyId": "string",
  "GeoDistance": 0,
  "ThingTag": [
    "string"
  ],
  "Latitude": 0,
  "Longitude": 0,
  "FencingRadius": 0,
  "UnavailabilityTime": "2022-05-30T09:53:47.060Z",
  "IPv4": "string",
  "IPv4PoolId": "string",
  "IPv4AllocationPolicy": "string",
  "IPv4Lock": true,
  "IPv6": "string",
  "IPv6PoolId": "string",
  "IPv6AllocationPolicy": "string",
  "IPv6Lock": true,
  "FwBlockAttempts": 0,
  "StreetAddress": "string",
  "Remarks": "string",
  "hss": {
    "serviceSelection": "string",
    "pdnType": 0,
    "vplmnDynamicAddressAllowed": 0,
    "PDNgwAllocationType": 0,
    "ambr": {
      "maxRequestedBandwidthUL": 0,
      "maxRequestedBandwidthDL": 0
    },
    "epsQos": {
      "qosClassIden": 0,
      "priorityLevel": 0,
      "preemptionCapability": 0,
      "preemptionVulnerability": 0
    }
  },
  "State": "string",
  "BillingState": "string",
  "DateCreated": 0,
  "DateModified": 0,
  "DateAssignedToCustomer": 0,
  "IMEI": "string",
  "MasterIMEI": "string",
  "LockMasterImei": true,
  "IMSI": "string",
  "MSISDN": "string",
  "VcsAccountId": "string",
  "LastLocation": {
    "Timestamp": 0,
    "Type": "string",
    "Latitude": 0,
    "MCC": "string",
    "MNC": "string",
    "Longitude": 0,
    "AccuracyInKM": 0,
    "IMSI": "string",
    "IsLocationTypeAccurate": true,
    "CellId": 0,
    "Lac": 0
  },
  "LastAccuracyLocation": {
    "Timestamp": 0,
    "Type": "string",
    "Latitude": 0,
    "MCC": "string",
    "MNC": "string",
    "Longitude": 0,
    "AccuracyInKM": 0,
    "IMSI": "string",
    "IsLocationTypeAccurate": true,
    "CellId": 0,
    "Lac": 0
  },
  "RoamingRestrictions": [
    {
      "BlockRoaming": true,
      "BlockSMS": true,
      "BlockMOVoiceFlag": true,
      "BlockMTVoiceFlag": true,
      "DataRestrictionByterateLimit": "string",
      "MNOId": "string",
      "Preferred": true,
      "RoamingPartnerId": 0,
      "RoamingPlanId": "string",
      "ByterateFlag": true,
      "BlockMOSMSFlag": true
    }
  ],
  "Block": {
    "Data2G": true,
    "Data": true,
    "LTEData": true,
    "Data5G": true,
    "SMS_MO": true,
    "SMS_MT": true,
    "Supplementary_Services": true,
    "Voice_International": true,
    "Voice_International_Exc_Home": true,
    "Voice_MO": true,
    "Voice_MT": true,
    "Voice_Premium": true
  },
  "ActualUsage": {
    "MO_SMS_CDR_": 0,
    "Data_": 0,
    "Voice_": 0,
    "Alarm": 0
  },
  "APN": {
    "ShortId": "string",
    "DateModified": "string",
    "Name": "string",
    "ApnId": "string",
    "Description": "string",
    "IpRange": "string",
    "Ipv6Range": "string",
    "Type": "string",
    "InterfaceName": "string",
    "ServedByJpU": true,
    "DynamicIPAddress": true,
    "pdpsub": {
      "Delay-Class": 0,
      "Mean-Throughput": 0,
      "Pdp-ContextId": 0,
      "Peak-Throughput": 0,
      "Precedence-Class": 0,
      "Reliability-Class": 0,
      "PreferredDataMode": 0,
      "NonIpDataDelvMechanism": 0,
      "NonIPPDNTypeIndicator": 0,
      "qos": {
        "Delivery-Of-Erroneous-SDU": 0,
        "Delivery-Order": 0,
        "Guaranteed-Bit-Rate-For-DownLink": 0,
        "Guaranteed-Bit-Rate-For-Uplink": 0,
        "Guaranteed-Bit-Rate-ForDownlink(extended)": 0,
        "Maximum-Bit-Rate-For-Downlink": 0,
        "Maximum-Bit-Rate-For-Downlink(extended)": 0,
        "Maximum-Bit-Rate-For-Uplink": 0,
        "Maximum-SDU-Size": 0,
        "Priority": 0,
        "Residual-BER": 0,
        "SDU-Error-Ratio": 0,
        "Signaling-Indication": 0,
        "Source-Statistics-Descriptor": 0,
        "Traffic-Class": 0,
        "Traffic-Handling-Priority": 0,
        "Transfer-Delay": 0
      }
    }
  },
  "cas": "string"
}

```

{% endtab %}

{% tab title="401: Unauthorized Unauthorized" %}

```javascript
{
    Unauthorized
}
```

{% endtab %}

{% tab title="500: Internal Server Error Internal Server Error" %}

```javascript
{
    Error: CouchbaseError: The key does not exist on the server
}
```

{% endtab %}

{% tab title="404: Not Found Not found" %}

```javascript
{
    Not found
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Add your **Thing ICCID** and **Token** in the GET request to successfully obtain the Thing info.
{% endhint %}

### Example using **cURL**:

```bash
curl -X GET \
     --url "https://console.monogoto.io/thing/ThingId_ICCID_{THING_ICCID}/" \
     -H "accept: application/json" \
     -H "Authorization: Bearer {YOUR_TOKEN}"
```

Example of response to our request:

```json
      "State": "ACTIVE",
      "Status": "Serving",
      "SubProfId": "SubProfId_5652ayf1-er9c-4914-a60b-630cc4af0a2b",
      "ThingId": "ThingId_ICCID_8912372646888991",
      "Type": "MobileSubscriber",
      "VcsAccountId": null,
      "cas": 1236781245913489491,
      "ActualUsage": {
        "MO_SMS_CDR_": 3,
        "Data_": 45919688,
        "Voice_": 0,
        "Alarm": 0
```

{% openapi src="<https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FXtNpEMk17YOUrC39Cmvr%2FJPU_CustomerAPIV_Without_Test%20it.yaml?alt=media&token=09b74b38-dd09-4edc-8f98-4df792b3c986>" path="/thing/{ThingId}/" method="get" %}
[JPU\_CustomerAPIV\_Without\_Test it.yaml](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FXtNpEMk17YOUrC39Cmvr%2FJPU_CustomerAPIV_Without_Test%20it.yaml?alt=media\&token=09b74b38-dd09-4edc-8f98-4df792b3c986)
{% endopenapi %}

## 2nd API command - Update Thing Information

## Put Thing information

<mark style="color:orange;">`PUT`</mark> `https://console.monogoto.io/thing/update`

#### Headers

| Name                                          | Type   | Description               |
| --------------------------------------------- | ------ | ------------------------- |
| YOUR\_TOKEN<mark style="color:red;">\*</mark> | String | Your authentication token |

#### Request Body

| Name                                        | Type   | Description                                                      |
| ------------------------------------------- | ------ | ---------------------------------------------------------------- |
| ICCID<mark style="color:red;">\*</mark>     | String | The ICCID of your SIM                                            |
| NEW\_NAME<mark style="color:red;">\*</mark> | String | Name you wish your Thing to have                                 |
| CAS<mark style="color:red;">\*</mark>       | String | Value to confirm that you are using latest information for Thing |

{% tabs %}
{% tab title="200: OK OK" %}

```javascript
{
  "PricePlanInnerId": "string",
  "ThingId": "string",
  "ThingName": "string",
  "ThingDescription": "string",
  "ThingsGroupId": "string",
  "NetworkProviderId": "string",
  "RoamingPolicyId": "string",
  "ThingTag": [
    "string"
  ],
  "Latitude": 0,
  "Longitude": 0,
  "FencingRadius": 0,
  "UnavailabilityTime": "2022-06-21T10:57:26.629Z",
  "IPv4": "string",
  "IPv4Lock": true,
  "IPv6": "string",
  "IPv6Lock": true,
  "PIN1": "string",
  "PIN2": "string",
  "PUK1": "string",
  "PUK2": "string",
  "FwBlockAttempts": 0,
  "StreetAddress": "string",
  "Remarks": "string",
  "MasterIMEI": "string",
  "LockMasterImei": true,
  "MSISDN": "string",
  "RoamingPolicies": [
    {
      "NetworkProviderId": "string",
      "RoamingPolicyId": "string",
      "RoamingRestrictions": [
        {
          "BlockRoaming": true,
          "BlockSMS": true,
          "BlockMOVoiceFlag": true,
          "BlockMTVoiceFlag": true,
          "DataRestrictionByterateLimit": "string",
          "MNOId": "string",
          "Preferred": true,
          "RoamingPartnerId": 0,
          "RoamingPlanId": "string",
          "ByterateFlag": true,
          "BlockMOSMSFlag": true
        }
      ]
    }
  ],
  "Block": {
    "Data2G": true,
    "Data": true,
    "LTEData": true,
    "Data5G": true,
    "SMS_MO": true,
    "SMS_MT": true,
    "Supplementary_Services": true,
    "Voice_International": true,
    "Voice_International_Exc_Home": true,
    "Voice_MO": true,
    "Voice_MT": true,
    "Voice_Premium": true
  },
  "SimType": "string",
  "cas": "string",
  "PricePlans": [
    {
      "NetworkProviderId": "string",
      "PricePlanInnerId": "string",
      "Override": false
    }
  ]
}
```

{% endtab %}

{% tab title="401: Unauthorized Unauthorized" %}

```javascript
{
    Unauthorized
}
```

{% endtab %}

{% tab title="500: Internal Server Error Internal Server Error" %}

```javascript
{
    Error: CouchbaseError: The key does not exist on the server
}
```

{% endtab %}

{% tab title="404: Not Found Not found" %}

```javascript
{
    Not found
}
```

{% endtab %}

{% tab title="400 Invalid Input Data" %}

```javascript
{
  "message": "string"
}
```

{% endtab %}
{% endtabs %}

### Example using **cURL**:

```bash
curl -X PUT \
   --url "https://console.monogoto.io/thing/update/" \
   -H "accept: application/json" \
   -H "Content-Type: application/json" \
   -H "Authorization: Bearer {YOUR_TOKEN}" \
   -d "{ \"ThingId\": \"ThingId_ICCID_{ICCID}\", \"ThingName\": \"{NEW_NAME}\", \"cas\": \"{CAS}\"}"
```

Expected response:

```json
{
    Thing undefined successfully saved.
}
```

{% openapi src="<https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FXtNpEMk17YOUrC39Cmvr%2FJPU_CustomerAPIV_Without_Test%20it.yaml?alt=media&token=09b74b38-dd09-4edc-8f98-4df792b3c986>" path="/thing/update/" method="put" %}
[JPU\_CustomerAPIV\_Without\_Test it.yaml](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FXtNpEMk17YOUrC39Cmvr%2FJPU_CustomerAPIV_Without_Test%20it.yaml?alt=media\&token=09b74b38-dd09-4edc-8f98-4df792b3c986)
{% endopenapi %}
