Help Center> Data Ingestion Service> SDK Reference> Getting Started with SDK> Using the C SDK> Creating a Stream Whose Source Data Type Is BLOB, JSON, or CSV

Creating a Stream Whose Source Data Type Is BLOB, JSON, or CSV

//Configure the stream name.
char *pucStreamName = "myStream";
char *projectId = "d575b0b740e54221aeb9a165653b103d";
char *region = "southchina";
char *host = "XXX.XXX.XXX.XXX:XXX";
int ret = 0;
DISResponseInfo RspInfo = { 0 };
DISCreateStream *pstCreateStream = disMemAlloc(sizeof(DISCreateStream));
DISCreateStreamExpend *pstCreateStreamExpend = disMemAlloc(sizeof(DISCreateStreamExpend));
pstCreateStreamExpend->dataType = DISDataTypeBlob;
pstCreateStreamExpend->dataDuration = 2 * 24;

pstCreateStream->partitionCount = 10;
pstCreateStream->streamName = pucStreamName;
pstCreateStream->streamType = DISStreamTypeAdvanced;
pstCreateStream->pucReserved = pstCreateStreamExpend;

printf("===================%s Begin=======================\n", __FUNCTION__);
ret = CreateStream(host, projectId, region, pstCreateStream, &RspInfo);
if (ret != 0)
{
printf("Create Error: %d\r\n", ret);
printf("HttpResponseCode: %ld\r\n", RspInfo.HttpResponseCode);
printf("ErrorCode: %s\r\n", RspInfo.ErrorCode);
printf("ErrorDetail: %s\r\n", RspInfo.ErrorDetail);
}
else
{
printf("Create stream %s success\n", pstCreateStream->streamName);
printf("HttpResponseCode: %ld\r\n", RspInfo.HttpResponseCode);
}

disMemFree(pstCreateStream);
printf("===================%s End=======================\n", __FUNCTION__);

After configuring DISCreateStream, you can create the stream by calling createStream.

ret = CreateStream(host, projectId, region, pstCreateStream, &RspInfo);

Execution Result

Information similar to the following is displayed on the console:

Create stream myStream success
HttpResponseCode: 201