tmp/src/things/things.py
def addDraftThingType(self, thingTypeId, name = None, description = None, schemaId = None, metadata = None):
        """
        Creates a thing type.
        It accepts thingTypeId (string), name (string), description (string), schemaId(string) and metadata(dict) as parameter
        In case of failure it throws APIException
        """
        draftThingTypesUrl = ApiClient.draftThingTypesUrl % (self.host)
        payload = {'id' : thingTypeId, 'name' : name, 'description' : description, 'schemaId' : schemaId, 'metadata': metadata}

        r = requests.post(draftThingTypesUrl, auth=self.credentials, data=json.dumps(payload), headers = {'content-type': 'application/json'}, verify=self.verify)
        status = r.status_code
        if status == 201:
            self.logger.debug("The draft thing Type is created")
            return r.json()
        elif status == 400:
            raise ibmiotf.APIException(400, "Invalid request (No body, invalid JSON, unexpected key, bad value)", r.json())
        elif status == 401:
            raise ibmiotf.APIException(401, "The authentication token is empty or invalid", None)
        elif status == 403:
            raise ibmiotf.APIException(403, "The authentication method is invalid or the api key used does not exist", None)
        elif status == 409:
            raise ibmiotf.APIException(409, "The draft thing type already exists", r.json())
        elif status == 500:
            raise ibmiotf.APIException(500, "Unexpected error", None)
        else:
            raise ibmiotf.APIException(None, "Unexpected error", None)
def addDraftThingType(self, thingTypeId, name = None, description = None, schemaId = None, metadata = None):
        """
        Creates a thing type.
        It accepts thingTypeId (string), name (string), description (string), schemaId(string) and metadata(dict) as parameter
        In case of failure it throws APIException
        """
        draftThingTypesUrl = ApiClient.draftThingTypesUrl % (self.host)
        payload = {'id' : thingTypeId, 'name' : name, 'description' : description, 'schemaId' : schemaId, 'metadata': metadata}

        r = requests.post(draftThingTypesUrl, auth=self.credentials, data=json.dumps(payload), headers = {'content-type': 'application/json'}, verify=self.verify)
        status = r.status_code
        if status == 201:
            self.logger.debug("The draft thing Type is created")
            return r.json()
        elif status == 400:
            raise ibmiotf.APIException(400, "Invalid request (No body, invalid JSON, unexpected key, bad value)", r.json())
        elif status == 401:
            raise ibmiotf.APIException(401, "The authentication token is empty or invalid", None)
        elif status == 403:
            raise ibmiotf.APIException(403, "The authentication method is invalid or the api key used does not exist", None)
        elif status == 409:
            raise ibmiotf.APIException(409, "The draft thing type already exists", r.json())
        elif status == 500:
            raise ibmiotf.APIException(500, "Unexpected error", None)
        else:
            raise ibmiotf.APIException(None, "Unexpected error", None)
def addDraftThingType ( self , thingTypeId , name = None , description = None , schemaId = None , metadata = None ) : draftThingTypesUrl = ApiClient . draftThingTypesUrl % ( self . host ) payload = { 'id' : thingTypeId , 'name' : name , 'description' : description , 'schemaId' : schemaId , 'metadata' : metadata } r = requests . post ( draftThingTypesUrl , auth = self . credentials , data = json . dumps ( payload ) , headers = { 'content-type' : 'application/json' } , verify = self . verify ) status = r . status_code if status == 201 : self . logger . debug ( "The draft thing Type is created" ) return r . json ( ) elif status == 400 : raise ibmiotf . APIException ( 400 , "Invalid request (No body, invalid JSON, unexpected key, bad value)" , r . json ( ) ) elif status == 401 : raise ibmiotf . APIException ( 401 , "The authentication token is empty or invalid" , None ) elif status == 403 : raise ibmiotf . APIException ( 403 , "The authentication method is invalid or the api key used does not exist" , None ) elif status == 409 : raise ibmiotf . APIException ( 409 , "The draft thing type already exists" , r . json ( ) ) elif status == 500 : raise ibmiotf . APIException ( 500 , "Unexpected error" , None ) else : raise ibmiotf . APIException ( None , "Unexpected error" , None )
Creates a thing type.
        It accepts thingTypeId (string), name (string), description (string), schemaId(string) and metadata(dict) as parameter
        In case of failure it throws APIException
Creates a thing type . It accepts thingTypeId ( string ) name ( string ) description ( string ) schemaId ( string ) and metadata ( dict ) as parameter In case of failure it throws APIException