• [互动交流] 【OBS】【生成下载对象的URL】c-sdk获取下载对象的临时URL无法使用浏览器访问
    【功能模块】c-sdk 生成下载对象的URL【操作步骤&问题现象】1、参考c-sdk的demo写了一个获取下载对象的临时url函数static void test_gen_signed_url_get_object(char *bucket_name, char *key, char *versionid)2、获取到的url不能直接在浏览器中访问【截图信息】个人代码:std::pair<obs_status, tempAuthResult>HuaWeiOBS::getObjectTemporaryAuth(const std::string &bucketName,                                  const std::string &keyName,                                  const std::string &versionId){    std::pair<obs_status, tempAuthResult> urlPair =        std::make_pair(OBS_STATUS_BUTT, tempAuthResult());    // obs options configure    m_obsOptions.bucket_options.bucket_name = const_cast<char *>(bucketName.data());    obs_options option;    init_obs_options(&option);    option.bucket_options.bucket_name = const_cast<char *>(bucketName.data());    option.bucket_options.access_key = m_accessKey.data();    option.bucket_options.secret_access_key = m_secretAccessKey.data();    option.bucket_options.host_name = m_hostName.data();    // key info configure    obs_object_info objectInfo;    memset(&objectInfo, 0, sizeof(objectInfo));    objectInfo.key = const_cast<char *>(keyName.data());    objectInfo.version_id  = NULL;    // condition    obs_get_conditions getcondition;    memset(&getcondition, 0, sizeof(obs_get_conditions));    init_get_properties(&getcondition);    getcondition.start_byte = 0;    getcondition.byte_count = 100;    // callback prepair    std::string objectContent;    objectContent.reserve(1024);    get_object_callback_data data{objectContent, OBS_STATUS_BUTT};    // 定义下载的回调函数    obs_get_object_handler getObjectHandler = {        {&response_properties_callback, &get_object_complete_callback},        &get_object_data_callback};    // down object    tempAuthResult ptrResult;    temp_auth_configure tempauth;    tempauth.callback_data = (void *)(&ptrResult);    tempauth.expires = 10;    tempauth.temp_auth_callback = &object_temp_auth_callback;    option.temp_auth = &tempauth;    get_object(&option, &objectInfo, &getcondition, 0, &getObjectHandler, &data);    if (OBS_STATUS_OK == data.ret_status)    {        printf("gen key: %s object temporary url successfully.\n", keyName.data());    }    else    {        printf("en key: %s object temporary url faied(%s).\n", keyName.data(), obs_get_status_name(data.ret_status));    }    urlPair.first = data.ret_status;    urlPair.second = ptrResult;    return urlPair;}【日志信息】(可选,上传日志内容或者附件)2022-05-18 10:45:38 657| CRIT|[140132699154304]==============log start============2022-05-18 10:45:38 657| WARN|[140132699154304]|obs_initialize OBS SDK Version= 3.21.82022-05-18 10:45:38 658| WARN|[140132699154304]|curl_easy_setopt curl path= https://dtu.obs.cn-south-1.myhuaweicloud.com/?apiversion2022-05-18 10:45:38 774| WARN|[140132699154304]|enter request perform!!!2022-05-18 10:45:38 774| WARN|[140132699154304]|src for urlEncode is NULL.2022-05-18 10:45:38 774| WARN|[140132699154304]|request_perform status = 02022-05-18 10:45:38 774| WARN|[140132699154304]|enter request perform!!!2022-05-18 10:45:38 774| WARN|[140132699154304]|src for urlEncode is NULL.2022-05-18 10:45:38 774| WARN|[140132699154304]|compose_auth_header request_perform : StringToSign:  HEADx-amz-date:Wed, 18 May 2022 02:45:38 GMT/dtu/Test_HuangLi/DTU/3F000000010010031A8200012022-05-18 10:45:38 845| WARN|[140132699154304]|Content-Type:2022-05-18 10:45:38 845| WARN|[140132699154304]|User-Agent: obs-sdk-c-3.21.82022-05-18 10:45:38 845| WARN|[140132699154304]|x-amz-date: Wed, 18 May 2022 02:45:38 GMT2022-05-18 10:45:38 845| WARN|[140132699154304]|request_finish request_finish status = 0,httpResponseCode = 4042022-05-18 10:45:38 845| WARN|[140132699154304]|Message: (null)2022-05-18 10:45:38 845| WARN|[140132699154304]|Request Id: 00000180D50E7F6C930F8F0EEAA391DC2022-05-18 10:45:38 845| WARN|[140132699154304]|Reserved Indicator: (null)2022-05-18 10:45:38 846| WARN|[140132699154304]|enter request perform!!!2022-05-18 10:45:38 846| WARN|[140132699154304]|src for urlEncode is NULL.2022-05-18 10:45:38 846| WARN|[140132699154304]|compose_auth_header request_perform : StringToSign:  HEADx-amz-date:Wed, 18 May 2022 02:45:38 GMT/dtu/Test_HuangLi/DTU/3F000000010010031A820001/DeviceDescription2022-05-18 10:45:38 908| WARN|[140132699154304]|obs_initialize OBS SDK Version= 3.21.82022-05-18 10:45:38 908| WARN|[140132699154304]|obs_initialize OBS SDK Version= 3.21.82022-05-18 10:45:38 908| WARN|[140132699154304]|curl_easy_setopt curl path= https://dtu.obs.cn-south-1.myhuaweicloud.com/?apiversion2022-05-18 10:45:38 962| WARN|[140132699154304]|enter request perform!!!2022-05-18 10:45:38 962| WARN|[140132699154304]|src for urlEncode is NULL.2022-05-18 10:45:38 962| WARN|[140132699154304]|src for urlEncode is NULL.2022-05-18 10:45:38 962| WARN|[140132699154304]|compose_auth_header request_perform : StringToSign:  GETx-obs-date:Wed, 18 May 2022 02:45:38 GMT/dtu/2022-05-18 10:47:28 622| CRIT|[140737353881472]==============log start============2022-05-18 10:47:28 622| WARN|[140737353881472]|obs_initialize OBS SDK Version= 3.21.82022-05-18 10:47:51 501| WARN|[140737353881472]|curl_easy_setopt curl path= https://dtu.obs.cn-south-1.myhuaweicloud.com/?apiversion2022-05-18 10:47:51 639| WARN|[140737353881472]|enter request perform!!!2022-05-18 10:47:51 639| WARN|[140737353881472]|src for urlEncode is NULL.2022-05-18 10:49:11 035| WARN|[140737353881472]|request_perform status = 0
  • [互动交流] 【OBS】【安装SDK】composer无法安装
    【功能模块】安装SDK【操作步骤&问题现象】php版本7.4  composer版本2.3.51、运行composer require obs/esdk-obs-php执行安装。【截图信息】【日志信息】(可选,上传日志内容或者附件)
  • [开发资源] 二次开发,需要硬盘录像机NVR800的SDK包
    二次开发,需要硬盘录像机NVR800的SDK包
  • [知识分享] 设备如何使用go sdk轻松连接华为云IoT平台
    本文分享自华为云社区《[设备如何使用go sdk轻松连接华为云IoT平台](https://bbs.huaweicloud.com/blogs/349842?utm_source=csdn&utm_medium=bbs-ex&utm_campaign=iot&utm_content=content)》,作者:华为云IoT专家团 。 本文介绍使用[huaweicloud-iot-device-sdk-go](https://github.com/ctlove0523/huaweicloud-iot-device-sdk-go) 连接华为云IoT平台,实现简单的华为云文档介绍的四个功能:设备连接鉴权、设备命令、设备消息和设备属性。huaweicloud-iot-device-sdk-go提供设备接入华为云IoT物联网平台的Go版本的SDK,提供设备和平台之间通讯能力,以及设备服务、网关服务、OTA等高级服务。IoT设备开发者使用SDK可以大大简化开发复杂度,快速的接入平台。 Gihub项目地址:[huaweicloud-iot-device-sdk-go](https://github.com/ctlove0523/huaweicloud-iot-device-sdk-go) # 安装和构建 安装和构建的过程取决于使用go的 modules(推荐) 还是还是GOPATH # Modules 如果你使用 modules 只需要导入包"github.com/ctlove0523/huaweicloud-iot-device-sdk-go"即可使用。当你使用go build命令构建项目时,依赖的包会自动被下载。注意使用go build命令构建时会自动下载最新版本,最新版本还没有达到release的标准可能存在一些尚未修复的bug。如果想使用稳定的发布版本可以从release 获取最新稳定的版本号,并在go.mod文件中指定版本号。 module example go 1.15 require github.com/ctlove0523/huaweicloud-iot-device-sdk-go v0.0.1-alpha # GOPATH 如果你使用GOPATH,下面的一条命令即可实现安装 `go get github.com/ctlove0523/huaweicloud-iot-device-sdk-go` # 使用API # 创建设备并初始化 1、首先,在华为云IoT平台创建一个设备,设备的信息如下: 设备ID:5fdb75cccbfe2f02ce81d4bf_go-mqtt 设备密钥:123456789 2、使用SDK创建一个Device对象,并初始化Device。 // 创建一个设备并初始化 device := iot.CreateIotDevice("5fdb75cccbfe2f02ce81d4bf_go-mqtt", "123456789", "tcp://iot-mqtts.cn-north-4.myhuaweicloud.com:1883") device.Init() # 完整样例 import ( "fmt" "github.com/ctlove0523/huaweicloud-iot-device-sdk-go" "time" ) func main() { // 创建一个设备并初始化 device := iot.CreateIotDevice("5fdb75cccbfe2f02ce81d4bf_go-mqtt", "123456789", "tcp://iot-mqtts.cn-north-4.myhuaweicloud.com:1883") device.Init() if device.IsConnected() { fmt.Println("device connect huawei iot platform success") } else { fmt.Println("device connect huawei iot platform failed") } } >iot-mqtts.cn-north-4.myhuaweicloud.com为华为IoT平台(基础班)在华为云北京四的访问端点,如果你购买了标准版或企业版,请将iot-mqtts.cn-north-4.myhuaweicloud.com更换为对应的MQTT协议接入端点。 # 设备处理平台下发的命令 1、首先,在华为云IoT平台创建一个设备,设备的信息如下: 设备ID:5fdb75cccbfe2f02ce81d4bf_go-mqtt 设备密钥:123456789 2、使用SDK创建一个Device对象,并初始化Device。 // 创建一个设备并初始化 device := iot.CreateIotDevice("5fdb75cccbfe2f02ce81d4bf_go-mqtt", "123456789", "tcp://iot-mqtts.cn-north-4.myhuaweicloud.com:1883") device.Init() if device.IsConnected() { fmt.Println("device connect huawei iot platform success") } else { fmt.Println("device connect huawei iot platform failed") } 3、注册命令处理handler,支持注册多个handler并且按照注册的顺序回调 // 添加用于处理平台下发命令的callback device.AddCommandHandler(func(command iot.Command) bool { fmt.Println("First command handler begin to process command.") return true }) device.AddCommandHandler(func(command iot.Command) bool { fmt.Println("Second command handler begin to process command.") return true }) 4、通过应用侧API向设备下发一个命令,可以看到程序输出如下: device connect huawei iot platform success First command handler begin to process command. Second command handler begin to process command. # 完整样例 import ( "fmt" "github.com/ctlove0523/huaweicloud-iot-device-sdk-go" "time" ) // 处理平台下发的同步命令 func main() { // 创建一个设备并初始化 device := iot.CreateIotDevice("5fdb75cccbfe2f02ce81d4bf_go-mqtt", "123456789", "tcp://iot-mqtts.cn-north-4.myhuaweicloud.com:1883") device.Init() if device.IsConnected() { fmt.Println("device connect huawei iot platform success") } else { fmt.Println("device connect huawei iot platform failed") } // 添加用于处理平台下发命令的callback device.AddCommandHandler(func(command iot.Command) bool { fmt.Println("First command handler begin to process command.") return true }) device.AddCommandHandler(func(command iot.Command) bool { fmt.Println("Second command handler begin to process command.") return true }) time.Sleep(1 * time.Minute) } >设备支持的命令定义在产品中 # 设备消息 1、首先,在华为云IoT平台创建一个设备,设备的信息如下: 设备ID:5fdb75cccbfe2f02ce81d4bf_go-mqtt 设备密钥:123456789 2、使用SDK创建一个Device对象,并初始化Device。 device := iot.CreateIotDevice("5fdb75cccbfe2f02ce81d4bf_go-mqtt", "123456789", "tcp://iot-mqtts.cn-north-4.myhuaweicloud.com:1883") device.Init() # 设备消息上报 message := iot.Message{ ObjectDeviceId: uuid.NewV4().String(), Name: "Fist send message to platform", Id: uuid.NewV4().String(), Content: "Hello Huawei IoT Platform", } device.SendMessage(message) # 平台消息下发 接收平台下发的消息,只需注册消息处理handler,支持注册多个handler并按照注册顺序回调。 // 注册平台下发消息的callback,当收到平台下发的消息时,调用此callback. // 支持注册多个callback,并且按照注册顺序调用 device.AddMessageHandler(func(message iot.Message) bool { fmt.Println("first handler called" + iot.Interface2JsonString(message)) return true }) device.AddMessageHandler(func(message iot.Message) bool { fmt.Println("second handler called" + iot.Interface2JsonString(message)) return true }) # 完整样例 import ( "fmt" iot "github.com/ctlove0523/huaweicloud-iot-device-sdk-go" uuid "github.com/satori/go.uuid" "time" ) func main() { // 创建一个设备并初始化 device := iot.CreateIotDevice("5fdb75cccbfe2f02ce81d4bf_go-mqtt", "123456789", "tcp://iot-mqtts.cn-north-4.myhuaweicloud.com:1883") device.Init() // 注册平台下发消息的callback,当收到平台下发的消息时,调用此callback. // 支持注册多个callback,并且按照注册顺序调用 device.AddMessageHandler(func(message iot.Message) bool { fmt.Println("first handler called" + iot.Interface2JsonString(message)) return true }) device.AddMessageHandler(func(message iot.Message) bool { fmt.Println("second handler called" + iot.Interface2JsonString(message)) return true }) //向平台发送消息 message := iot.Message{ ObjectDeviceId: uuid.NewV4().String(), Name: "Fist send message to platform", Id: uuid.NewV4().String(), Content: "Hello Huawei IoT Platform", } device.SendMessage(message) time.Sleep(2 * time.Minute) } # 设备属性 1、首先,在华为云IoT平台创建一个设备,并在该设备下创建3个子设备,设备及子设备的信息如下: 设备ID:5fdb75cccbfe2f02ce81d4bf_go-mqtt 设备密钥:123456789 子设备ID:5fdb75cccbfe2f02ce81d4bf_sub-device-1 子设备ID:5fdb75cccbfe2f02ce81d4bf_sub-device-2 子设备ID:5fdb75cccbfe2f02ce81d4bf_sub-device-3 2、使用SDK创建一个Device对象,并初始化Device。 // 创建设备并初始化 device := iot.CreateIotDevice("5fdb75cccbfe2f02ce81d4bf_go-mqtt", "123456789", "tcp://iot-mqtts.cn-north-4.myhuaweicloud.com:1883") device.Init() fmt.Printf("device connected: %v\n", device.IsConnected()) # 设备属性上报 使用ReportProperties(properties ServiceProperty) bool 上报设备属性 // 设备上报属性 props := iot.ServicePropertyEntry{ ServiceId: "value", EventTime: iot.DataCollectionTime(), Properties: DemoProperties{ Value: "chen tong", MsgType: "23", }, } var content []iot.ServicePropertyEntry content = append(content, props) services := iot.ServiceProperty{ Services: content, } device.ReportProperties(services) # 网关批量设备属性上报 使用BatchReportSubDevicesProperties(service DevicesService) 实现网关批量设备属性上报 // 批量上报子设备属性 subDevice1 := iot.DeviceService{ DeviceId: "5fdb75cccbfe2f02ce81d4bf_sub-device-1", Services: content, } subDevice2 := iot.DeviceService{ DeviceId: "5fdb75cccbfe2f02ce81d4bf_sub-device-2", Services: content, } subDevice3 := iot.DeviceService{ DeviceId: "5fdb75cccbfe2f02ce81d4bf_sub-device-3", Services: content, } var devices []iot.DeviceService devices = append(devices, subDevice1, subDevice2, subDevice3) device.BatchReportSubDevicesProperties(iot.DevicesService{ Devices: devices, }) # 平台设置设备属性 使用AddPropertiesSetHandler(handler DevicePropertiesSetHandler) 注册平台设置设备属性handler,当接收到平台的命令时SDK回调。 // 注册平台设置属性callback,当应用通过API设置设备属性时,会调用此callback,支持注册多个callback device.AddPropertiesSetHandler(func(propertiesSetRequest iot.DevicePropertyDownRequest) bool { fmt.Println("I get property set command") fmt.Printf("request is %s", iot.Interface2JsonString(propertiesSetRequest)) return true }) # 平台查询设备属性 使用SetPropertyQueryHandler(handler DevicePropertyQueryHandler)注册平台查询设备属性handler,当接收到平台的查询请求时SDK回调。 // 注册平台查询设备属性callback,当平台查询设备属性时此callback被调用,仅支持设置一个callback device.SetPropertyQueryHandler(func(query iot.DevicePropertyQueryRequest) iot.ServicePropertyEntry { return iot.ServicePropertyEntry{ ServiceId: "value", Properties: DemoProperties{ Value: "QUERY RESPONSE", MsgType: "query property", }, EventTime: "2020-12-19 02:23:24", } }) # 设备侧获取平台的设备影子数据 使用QueryDeviceShadow(query DevicePropertyQueryRequest, handler DevicePropertyQueryResponseHandler) 可以查询平台的设备影子数据,当接收到平台的响应后SDK自动回调DevicePropertyQueryResponseHandler。 // 设备查询设备影子数据 device.QueryDeviceShadow(iot.DevicePropertyQueryRequest{ ServiceId: "value", }, func(response iot.DevicePropertyQueryResponse) { fmt.Printf("query device shadow success.\n,device shadow data is %s\n", iot.Interface2JsonString(response)) }) # 完整样例 import ( "fmt" iot "github.com/ctlove0523/huaweicloud-iot-device-sdk-go" "time" ) func main() { // 创建设备并初始化 device := iot.CreateIotDevice("5fdb75cccbfe2f02ce81d4bf_go-mqtt", "123456789", "tcp://iot-mqtts.cn-north-4.myhuaweicloud.com:1883") device.Init() fmt.Printf("device connected: %v\n", device.IsConnected()) // 注册平台设置属性callback,当应用通过API设置设备属性时,会调用此callback,支持注册多个callback device.AddPropertiesSetHandler(func(propertiesSetRequest iot.DevicePropertyDownRequest) bool { fmt.Println("I get property set command") fmt.Printf("request is %s", iot.Interface2JsonString(propertiesSetRequest)) return true }) // 注册平台查询设备属性callback,当平台查询设备属性时此callback被调用,仅支持设置一个callback device.SetPropertyQueryHandler(func(query iot.DevicePropertyQueryRequest) iot.ServicePropertyEntry { return iot.ServicePropertyEntry{ ServiceId: "value", Properties: DemoProperties{ Value: "QUERY RESPONSE", MsgType: "query property", }, EventTime: "2020-12-19 02:23:24", } }) // 设备上报属性 props := iot.ServicePropertyEntry{ ServiceId: "value", EventTime: iot.DataCollectionTime(), Properties: DemoProperties{ Value: "chen tong", MsgType: "23", }, } var content []iot.ServicePropertyEntry content = append(content, props) services := iot.ServiceProperty{ Services: content, } device.ReportProperties(services) // 设备查询设备影子数据 device.QueryDeviceShadow(iot.DevicePropertyQueryRequest{ ServiceId: "value", }, func(response iot.DevicePropertyQueryResponse) { fmt.Printf("query device shadow success.\n,device shadow data is %s\n", iot.Interface2JsonString(response)) }) // 批量上报子设备属性 subDevice1 := iot.DeviceService{ DeviceId: "5fdb75cccbfe2f02ce81d4bf_sub-device-1", Services: content, } subDevice2 := iot.DeviceService{ DeviceId: "5fdb75cccbfe2f02ce81d4bf_sub-device-2", Services: content, } subDevice3 := iot.DeviceService{ DeviceId: "5fdb75cccbfe2f02ce81d4bf_sub-device-3", Services: content, } var devices []iot.DeviceService devices = append(devices, subDevice1, subDevice2, subDevice3) device.BatchReportSubDevicesProperties(iot.DevicesService{ Devices: devices, }) time.Sleep(1 * time.Minute) } type DemoProperties struct { Value string `json:"value"` MsgType string `json:"msgType"` }
  • [问题求助] 使用CloudLink Kit 21.0.0.6 版本的Uos_amd64的SDK二次开发的问题
    使用CloudLink Kit 21.0.0.6 版本的Uos_amd64的SDK二次开发,项目中引入了-lsecurec -lz -ltup_logone -ltup_os_adapter -ltsdk_service引入libtsdk_service.so库之后,报以下错误。:-1: error: /home/uos/sdkTest/libtsdk_service.so: undefined reference to `TUP_CRYPT_GetblockSize':-1: error: /home/uos/sdkTest/libtsdk_service.so: undefined reference to `TUP_CPYPT_RealRandom':-1: error: /home/uos/sdkTest/libtsdk_service.so: undefined reference to `TUP_CPYPT_Decrypt':-1: error: /home/uos/sdkTest//libtsdk_service.so: undefined reference to `TUP_CPYPT_Encrypt'这个TUP_CPYPT的问题我应该引入哪个库才可以解决?
  • [互动交流] 【SDK for PHP】composer 安装报错
    composer require obs/esdk-obs-php Using version ^3.21 for obs/esdk-obs-php ./composer.json has been updated Running composer update obs/esdk-obs-php Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - Root composer.json requires obs/esdk-obs-php ^3.21 -> satisfiable by obs/esdk-obs-php[3.21.6]. - obs/esdk-obs-php 3.21.6 requires guzzlehttp/guzzle 6.3.0 -> found guzzlehttp/guzzle[6.3.0] but it conflicts with your root composer.json require (^7.0.1). Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions. Installation failed, reverting ./composer.json and ./composer.lock to their original content.这个问题存在好久了,好多新项目中使用不了SDK,麻烦尽快升级下 guzzlehttp/guzzle 版本吧!
  • [PLC专区] 【尾端PLC-IoT产品】【I2C功能】读数据接口MSDK_I2cRecvData读数错误,实际输出波形异常
    【功能模块】IIC模块调用接收数据接口MSDK_I2cRecvData(),实际输出波形异常:【操作步骤&问题现象】1、调用IIC读写接口,先写一个数据地址再读数据,一直接收到0xFF    MSDK_I2cData_s  i2cData = {0};     i2c_send_data[0] = 0x01;    i2cData.pSendBuf = &i2c_send_data;    i2cData.pReceiveBuf = data;    i2cData.ulSendLength = 1;    i2cData.ulReceiveLength = 0;    trying = I2C_TRYING_COUNT;    while ( trying-- ) {        ret = MSDK_I2cSendData(g_i2cId, IP5970_SLAVE_ADDRESS<<1, &i2cData);            if ( ret != MSDK_ERR_SUCCESS ) {               VOS_T_Delay(100);        } else {            break;        }    }    i2cData.pReceiveBuf = data;    i2cData.ulSendLength = 0;    i2cData.ulReceiveLength = 1;        trying = I2C_TRYING_COUNT;    while ( trying-- ) {        ret = MSDK_I2cRecvData(g_i2cId, IP5970_SLAVE_ADDRESS<<1, &i2cData);            if ( ret != MSDK_ERR_SUCCESS ) {               VOS_T_Delay(100);        } else {            break;        }    }2、单独调用IIC接收函数接收数据,一直接收到0xFF    i2cData.pReceiveBuf = data;    i2cData.ulSendLength = 0;    i2cData.ulReceiveLength = 1;        trying = I2C_TRYING_COUNT;    while ( trying-- ) {        ret =MSDK_I2cRecvData(g_i2cId, IP5970_SLAVE_ADDRESS<<1, &i2cData);            if ( ret != MSDK_ERR_SUCCESS ) {               VOS_T_Delay(100);        } else {            break;        }    }3、使用逻辑分析仪抓IIC输出的波形,发现输出的波形是错误的【截图信息】1、调用IIC读写接口,先写一个数据地址再读数据,一直接收到0xFF2、单独调用IIC接收函数接收数据的波形【日志信息】(可选,上传日志内容或者附件)版本日志:                                                                               mini-boot v200 0.0.8                                                            2019-06-06 11:11:11     iic 读数据日志:
  • [技术干货] 智慧园区API和SDK的定义要求
    Rest APIREST中定义工程对外提供的服务。HTTP动词:常用的HTTP动词如下(括号里是对应的SQL命令):GET(SELECT):从服务器取出一项或多项资源。POST(CREATE):在服务器新建一个资源。PUT(UPDATE):客户端提供改变后的完整资源,在服务器更新资源。PATCH(UPDATE):客户端提供改变的属性,在服务器更新资源。DELETE(DELETE):从服务器删除资源。资源路径:URL中不能有动词在Restful架构中,每个网址代表的是一种资源,所以网址中不能有动词,只能有名词,动词由HTTP的动作来表示。URL结尾不应该包含斜杠“/”正斜杠(/)不会增加语义值,且可能导致混淆。正斜杠分隔符“/”必须用来指示层级关系路径中的正斜杠“/“字符用于指示资源之间的层次关系。应该使用连字符“-”来提高URL的可读性,而不是使用下划线“_”一些文本查看器为了区分强调URL,会在URL下加上下划线。这样下划线”_”字符可能被文本查看器中默认的下划线部分地遮蔽或完全隐藏。为避免这种混淆,请使用连字符而不是下划线。URL路径中首选小写字母URL是对大小写敏感的,所以为了避免歧义,尽量用小写字符。补充说明:主机名(Host)和scheme对大小写是不敏感的。应该将API的版本号放入URL另一种做法是,将版本号放在HTTPS头信息中,但不如放入URL方便和直观。URL路径名词均为复数为了保证URL格式的一致性,建议使用复数形式。响应状态码200 | OK :用于一般性的成功返回。201 | Created [POST/PUT/PATCH]:用户新建或修改数据成功。202 | Accepted:用于Controller控制类资源异步处理的返回,仅表示请求已经收到。对于耗时比较久的处理,一般用异步处理来完成。204 | No Content:此状态可能会出现在PUT、POST、DELETE的请求中,一般表示资源存在,但消息体中不会返回任何资源相关的状态或信息。301 | Moved Permanently:资源的URI被转移,需要使用新的URI访问。302 | Found:不推荐使用,此代码在HTTP1.1协议中被303/307替代。目前对302的使用和最初HTTP1.0定义的语意是有出入的,应该只有在GET/HEAD方法下,客户端才能根据Location执行自动跳转,而目前的客户端基本上是不会判断原请求方法的,无条件的执行临时重定向。303 | See Other: 返回一个资源地址URI的引用,但不强制要求客户端获取该地址的状态(访问该地址)。304 | Not Modified:有一些类似于204状态,服务器端的资源与客户端最近访问的资源版本一致,并无修改,不返回资源消息体。可以用来降低服务端的压力。307 | Temporary Redirect: 目前URI不能提供当前请求的服务,临时性重定向到另外一个URI。在HTTP1.1中307是用来替代早期HTTP1.0中使用不当的302。400 | Bad Request:用于客户端一般性错误返回,在其它4xx错误以外的错误,也可以使用400,具体错误信息可以放在body中。401 | Unauthorized: 在访问一个需要验证的资源时,验证错误。403 | Forbidden:一般用于非验证性资源访问被禁止,例如对于某些客户端只开放部分API的访问权限,而另外一些API可能无法访问时,可以给予403状态。404 | Not Found:找不到URI对应的资源。405 | Method Not Allowed:HTTP的方法不支持,例如某些只读资源,可能不支持POST/DELETE。但405的响应header中必须声明该URI所支持的方法。406 | Not Acceptable:客户端所请求的资源数据格式类型不被支持,例如客户端请求数据格式为application/xml,但服务器端只支持application/json。409 | Conflict: 资源状态冲突,例如客户端尝试删除一个非空的Store资源。412 | Precondition Failed:用于有条件的操作不被满足时。415 | Unsupported Media Type:客户所支持的数据类型,服务端无法满足。500 | Internal Server Error:服务器端的接口错误,此错误于客户端无关。SDKSDK表示工程对应用编排提供的API,SDK没有暴露REST接口。BO之间调用,只能使用SDK。
  • [互动交流] obs-c-sdk
    求一个 windows10下 编译 obs-c-sdk 的说明教程
  • [热门活动] 如何在华为Stack上开发自动化部署?
    我在华为公有云上用PYTHON SDK开发了一些自动化部署的小工具,用于公司内部测试。在华为Stack上怎么也能做自动化部署的开发呢?直接用公有云的PYTHON SDK?还是用ManageOne?谢谢指点!
  • [SDK] SMC 2.0 SDK 19.1.3 PC桌面共享的能力支持5760*2160分辨率吗
    SMC版本:HUAWEI SMC 2.0 V600R019C10SPC953会议类型:数据会议TE 移动端基于SDK19.1.3版本开发的,在桌面共享的时候,1080P分辨率的设备,桌面共享正常;在分辨率为5760*2160的工作站设备上桌面共享,延迟7-20秒;需要确认这个SDK支持的能力范围
  • [问题求助] 关于查询设备历史数据API的问题
    【功能模块】设备接入 IOTDA【操作步骤&问题现象】1、最新版API没有提供对查询设备历史数据功能的支持吗?2、旧版API中查询设备历史数据请求的host、port分别是多少?app_key在哪里查看?【截图信息】【日志信息】(可选,上传日志内容或者附件)
  • [问题求助] 华为云Stack的API有sdk吗
    有sdk吗,用api毕竟不太方便,主要是管理虚拟机、网络等资源
  • [视频直播] 华为有提供推送的sdk么?在手机上(浙政钉上)可以推流到直播中心?
    华为有提供推送的sdk么?在手机上(浙政钉上)可以推流到直播中心?
  • [优秀实践] DocSDK 在“园区文档全文检索系统”中的作用
      九云图DocSDK智能文档格式转换系统(九云图DocSDK Server,www.docsdk.com ),是一个服务器软件,提供了开发接口(API),能够解决各类文档格式转换问题。用户通过部署该产品,可以在软件产品中,快速实现涉及文档格式转换的相关功能,提高研发效率。下面是一个“通用文档全文检索系统”产品技术方案架构示意图:  该方案部署了九云图DocSDK Server,用来支持非结构化文档。主要作用如下:1. 格式解析。对所支持的Office/WPS/ODF/CAD/PDF等各类文档进行格式解析,将文档的非结构化信息解析成结构化的 JSON 格式,用于建立索引;2. 版面重建。一些绝对定位的文档中,缺少准确的段落描述,比如有的文档的豆腐块版式,文本PDF,文字是以零散方式描述的位置信息。这种方式预览阅读时没有问题,视觉效果上具有段落区分。但程序在进行全文检索时,就会出现错漏情况。九云图DocSDK通过智能算法,根据文字位置、字体、内容的相关信息,准确划分段落,实现版面重建;3. 表格识别。表格里的信息天然具备结构化特征,很多情况检索时需要利用这类特征。但有些文档表面看起来是表格,实际并没有行列关系的描述,这时就需要通过表格识别算法,将行列关系还原出来;4. 在线展现。检索结果需要在线展现,九云图DocSDK对各类文档提供了三种在线展现形式,图片、传统HTML和HTML5。图片方式通用性好,但缩放时存在不清晰现象。传统HTML可以支持交互,能实现内容标注、编辑等需求。但由于描述能力限制,展现复杂格式存在不完全兼容的情况。HTML5兼容性好,通过嵌入字库子集,在移动端缺少字库的情况下,也能准确展现出各种字体效果。九云图DocSDK系统运行需求是4核32G,最大支持500M文档,每秒钟能处理5~10页内容。采用多线程技术,可同时处理20个文档,超过20个时自动排队。对于高并发场景,可部署集群,集群方案采用MongoDB做中间件,支持负载均衡。
总条数:873 到第
上滑加载中