tmp/src/things/things.py
def updateMappingsOnDeviceType(self, thingTypeId, logicalInterfaceId, mappingsObject, notificationStrategy = "never"):
        """
        Add mappings for a thing type.
        Parameters:
            - thingTypeId (string) - the thing type
            - logicalInterfaceId (string) - the id of the application interface these mappings are for
            - notificationStrategy (string) - the notification strategy to use for these mappings
            - mappingsObject (Python dictionary corresponding to JSON object) example:

            { # eventid -> { property -> eventid property expression }
         "status" :  {
                "eventCount" : "($state.eventCount == -1) ? $event.d.count : ($state.eventCount+1)",
           }
      }

        Throws APIException on failure.
        """
        req = ApiClient.oneThingTypeMappingUrl % (self.host, "/draft", thingTypeId, logicalInterfaceId)
        try:
            mappings = json.dumps({
                "logicalInterfaceId" : logicalInterfaceId,
                "notificationStrategy" : notificationStrategy,
                "propertyMappings" : mappingsObject
            })
        except Exception as exc:
            raise ibmiotf.APIException(-1, "Exception formatting mappings object to JSON", exc)
        resp = requests.put(req, auth=self.credentials, headers={"Content-Type":"application/json"}, data=mappings,
               verify=self.verify)
        if resp.status_code == 200:
            self.logger.debug("Thing type mappings updated for logical interface")
        else:
            raise ibmiotf.APIException(resp.status_code, "HTTP error updating thing type mappings for logical interface", resp)
        return resp.json()
def updateMappingsOnDeviceType(self, thingTypeId, logicalInterfaceId, mappingsObject, notificationStrategy = "never"):
        """
        Add mappings for a thing type.
        Parameters:
            - thingTypeId (string) - the thing type
            - logicalInterfaceId (string) - the id of the application interface these mappings are for
            - notificationStrategy (string) - the notification strategy to use for these mappings
            - mappingsObject (Python dictionary corresponding to JSON object) example:

            { # eventid -> { property -> eventid property expression }
         "status" :  {
                "eventCount" : "($state.eventCount == -1) ? $event.d.count : ($state.eventCount+1)",
           }
      }

        Throws APIException on failure.
        """
        req = ApiClient.oneThingTypeMappingUrl % (self.host, "/draft", thingTypeId, logicalInterfaceId)
        try:
            mappings = json.dumps({
                "logicalInterfaceId" : logicalInterfaceId,
                "notificationStrategy" : notificationStrategy,
                "propertyMappings" : mappingsObject
            })
        except Exception as exc:
            raise ibmiotf.APIException(-1, "Exception formatting mappings object to JSON", exc)
        resp = requests.put(req, auth=self.credentials, headers={"Content-Type":"application/json"}, data=mappings,
               verify=self.verify)
        if resp.status_code == 200:
            self.logger.debug("Thing type mappings updated for logical interface")
        else:
            raise ibmiotf.APIException(resp.status_code, "HTTP error updating thing type mappings for logical interface", resp)
        return resp.json()
Add mappings for a thing type.
        Parameters:
            - thingTypeId (string) - the thing type
            - logicalInterfaceId (string) - the id of the application interface these mappings are for
            - notificationStrategy (string) - the notification strategy to use for these mappings
            - mappingsObject (Python dictionary corresponding to JSON object) example:

            { # eventid -> { property -> eventid property expression }
         "status" :  {
                "eventCount" : "($state.eventCount == -1) ? $event.d.count : ($state.eventCount+1)",
           }
      }

        Throws APIException on failure.