Jobs

Contents

Step 1: Login.. 1

Step 2: File Upload.. 1

1.1        Create the File Metadata. 1

1.2        Upload the File contents. 1

Step 3: File Search.. 1

Step 4: Job Creation.. 1

Appendix A:  DeviceTypes & FileTypes. 1

Appendix B:  SmartSearch. 1

1.1        SmartSearch Example Formats. 1

1.2        SmartSearch Searchable Properties. 1

Appendix C: Permissions. 1

 

 

Step 1: Login

Many of the requests outlined in this document require `Full Authentication` which is denoted by a cookie attached to the requests. To initially get the authentication cookie, use the request below with the `Content-Type: application/x-www-form-urlencoded` header.

POST:  https://connect.calamp.com/connect/services/login

Headers:

          Content-Type: application/x-www-form-urlencoded

 

EXAMPLE BODY:
username: Your CTC username
password: Your CTC password
useAuthToken: true

Step 2: File Upload

1.1        Create the File Metadata

The first task in uploading a file is to declare what type of file is going to be uploaded.  Please update the items highlighted in yellow with information relevant for the file being uploaded.

The deviceTypeId, fileTypeId, platformId, deviceTypeName, fileTypeName, and platformName can be retrieved with the API described in Appendix A or from the table in Appendix A.

The “fields:” {} section will need to populated with the required parameters as specified in the “inputFields”: {} sections of the API described in Appendix A.

 

POST:  https://connect.calamp.com/device-services/files

Headers:

          calamp-services-app: {your_api_key}

          Content-Type: application/json

 

EXAMPLE BODY for PEG2 Script: 
{
"name": "Your filename goes here",
"description": "Your description goes here",
"accountId": 1110,
"inheritableAccounts": null,
"inheritable": true,
"releaseNotesUrl": "",
"releaseNoteAttached": false,
"metadata": {
    "deviceTypeId":"0",
    "fileTypeId":"22",
    "platformId":"373",
    "platformName":"LMU PEG2",
    "fileTypeName": "PEG2",
    "deviceTypeName": "LMU",
    "fields":{
            “version”: “1.123
     }
}
}

 

EXAMPLE BODY for LMU Config (PEG script): 
{
    "name": "Your filename goes here ",
    "description": " Your description goes here",
    "accountId": 1110,
    "inheritable": true,
    "inheritableAccounts": null,
    "releaseNotesUrl": "",
    "releaseNoteAttached": false,
    "metadata": {
        "deviceTypeId": "0",
        "deviceTypeName": "LMU",
        "fileTypeId": "1",
        "fileTypeName": "Config",
        "platformId": "366",
        "platformName": "LMU Config",
        "fields": {
            "version": "1.123"
        }
    }
}

 

 

EXAMPLE BODY for Hosted App v5: 
{
"name": "Your filename goes here",
"description": "Your description goes here",
"accountId": 1110,
"inheritableAccounts": null,
"inheritable": true,
"releaseNotesUrl": "",
"releaseNoteAttached": false,
"metadata": {
    "deviceTypeId":"3",
    "fileTypeId":"21",
    "platformId":"391",
    "platformName":"Hosted App HostedApp V5 Firmware",
    "fileTypeName": "HostedApp V5 Firmware",
    "deviceTypeName": "Hosted App",
    "fields":{
        "hostedApp": [{
            "value":"250",
            "id":671, 
            "platformParamValues": [],
            "platformType": {
                "name":"hosted_app",
                "id":3,
                "description":"Hosted App"
            },
            "description":"App ID 250"
        }],
       "version": "1.123"
             }
          }
}
 
This API will save the metadata for the file to CTC and create a location for the file to live on AWS. In the response, there is an object called `fields` that will be used to complete part 2 of the upload process.
EXAMPLE RESPONSE:
{
    "response": {
        “results”: [{
            filemeta”: {
                “uploads”: {
                    “data”: {
                        signedUrl”: {
                            “fields”: {
                                “Policy”: "eyJ...="
                                “X-Amz-Algorithm": "AWS4-HMAC-SHA256"
                                “X-Amz-Credential": "AKIAYF3RJRYEAU2OQIVN/20230505/us-east-1/s3/aws4_request"
                                “X-Amz-Date": "20230505T191114Z"
                                “X-Amz-Signature": "3d98527c4d513599efe7a0cc35af68b8a46c4d91c4ef924e14a39780b847fa4c"
                                “bucket”: "dmctc-prd-file-upload"
                                “key”: "ded9a33e-ee13-4acb-9d3c-c69273bcd3ff.dat"
                            }
                        }
                    }
                }
            }
        }]
    }
}
 

1.2  &