tmp/src/things/things.py
def createSchema(self, schemaName, schemaFileName, schemaContents, description=None):
        """
        Create a schema for the org.
        Returns: schemaId (string), response (object).
        Throws APIException on failure
        """
        req = ApiClient.allSchemasUrl % (self.host, "/draft")
        fields={
        'schemaFile': (schemaFileName, schemaContents, 'application/json'),
            'schemaType': 'json-schema',
            'name': schemaName,
        }
        if description:
            fields["description"] = description

        multipart_data = MultipartEncoder(fields=fields)
        resp = requests.post(req, auth=self.credentials, data=multipart_data,
                            headers={'Content-Type': multipart_data.content_type}, verify=self.verify)
        if resp.status_code == 201:
            self.logger.debug("Schema created")
        else:
            raise ibmiotf.APIException(resp.status_code, "HTTP error creating a schema", resp)
        return resp.json()["id"], resp.json()
def createSchema(self, schemaName, schemaFileName, schemaContents, description=None):
        """
        Create a schema for the org.
        Returns: schemaId (string), response (object).
        Throws APIException on failure
        """
        req = ApiClient.allSchemasUrl % (self.host, "/draft")
        fields={
        'schemaFile': (schemaFileName, schemaContents, 'application/json'),
            'schemaType': 'json-schema',
            'name': schemaName,
        }
        if description:
            fields["description"] = description

        multipart_data = MultipartEncoder(fields=fields)
        resp = requests.post(req, auth=self.credentials, data=multipart_data,
                            headers={'Content-Type': multipart_data.content_type}, verify=self.verify)
        if resp.status_code == 201:
            self.logger.debug("Schema created")
        else:
            raise ibmiotf.APIException(resp.status_code, "HTTP error creating a schema", resp)
        return resp.json()["id"], resp.json()
Create a schema for the org.
        Returns: schemaId (string), response (object).
        Throws APIException on failure