Upload CSV file for scoring
Uploads a comma-separated values (CSV) file that is used for scoring. When you upload a CSV file, the data is loaded into Watson™ IoT Platform. The next time that you score, the data is used for scoring.
- URL
-
APM_API_BASEURL/ibm/pmi/service/file_upload?instanceId=APM_ID&entityType=entityTypeInNotebook
- Method
-
The request type POST
- URL parameters
-
instanceId: String. The APM ID in the Maximo® APM - Predictive Maintenance Insights SaaS welcome letter. Mandatory.entityType: String. The entityType used in the Jupyter Notebook. Mandatory. - Headers
-
apmapitoken: APM_API_KEY.The API key, which is used for authentication. Mandatory. - Data parameters
- None.
- Sample body
-
Body: form-data Key=file Value=test2.csv - Success response
200- Sample Curl call
-
curl -X POST \ '{{APM_API_BASEURL}}/ibm/pmi/service/file_upload?instanceId=xxxxxxxxxxx&entityType=TrainBrakeSensor' \ -H 'Content-Type: multipart/form-data' \ -H 'apmapitoken: xxxxxxxx \ -H 'content-type: multipart/form-data; boundary=--33' \ -F file=@/Users/test2.csv ) - Notes
-
The system uses the
apmapitokento do authentication. If you do not provide anapmapitoken, the system refuses your request.The column names of CVS must match the column names that you use in the pmlib.setup_iot function call in the Notebook. For example, in the Notebook, you havet = pmlib.setup_iot_type( name=iot_type, df=df, columns=[ 'TRAINBRAKESIMULATION_NUMBEROFPASSENGERS', 'TRAINBRAKESIMULATION_HUMIDITY', 'TRAINBRAKESIMULATION_LOAD', 'TRAINBRAKESIMULATION_AXLEVIBRATION', 'TRAINBRAKESIMULATION_TEMP', 'TRAINBRAKESIMULATION_OBSCOND', 'TRAINBRAKESIMULATION_RUNHOURS', 'TRAINBRAKESIMULATION_WHEELSPEED', 'TRAINBRAKESIMULATION_AXLEMOMENTUM', ], deviceid_column='deviceid', timestamp_column='rcv_timestamp_utc', timestamp_in_payload=True, rename_columns={ 'RCV_TIMESTAMP_UTC': 'customtime', 'TRAINBRAKESIMULATION_NUMBEROFPASSENGERS': 'passengers', 'TRAINBRAKESIMULATION_HUMIDITY': 'humidity', 'TRAINBRAKESIMULATION_LOAD': 'load', 'TRAINBRAKESIMULATION_AXLEVIBRATION': 'axlevibration', 'TRAINBRAKESIMULATION_TEMP': 'temp', 'TRAINBRAKESIMULATION_OBSCOND': 'obscond', 'TRAINBRAKESIMULATION_RUNHOURS': 'runhours', 'TRAINBRAKESIMULATION_WHEELSPEED': 'wheelspeed', 'TRAINBRAKESIMULATION_AXLEMOMENTUM': 'axlemomentum', }, write='deletefirst', use_wiotp=False)The columns of the CSV file that is used by the API must have the columns' names that are the values of the rename_columns dictionary (key:value pair) and DEVICETYPE and DEVICEID columns.
Column names are not case-sensitive.
Here is a sample CSV file:
PASSENGERS,HUMIDITY,LOAD,AXLEVIBRATION,TEMP,OBSCOND,RUNHOURS,WHEELSPEED,AXLEMOMENTUM,DEVICETYPE,DEVICEID,CUSTOMTIME 101,35,62,7,46,3,1,43,28,TrainBrakeSensor,TrainBrake_1,2019-07-11 03:24:34