全部建议 > 建议详情
  • 预审中
  • 预审通过
  • 已采纳
  • 4 已实现

【功能建议】iot 代码请求不到数据 已实现 编辑 删除

  • IoT数据分析 IoTA
  • 物联网云服务

场景描述:

https://console.huaweicloud.com/apiexplorer/#/openapi/IoTDA/sdk?api=ListDevices

我用在线测试的api生成的PHP代码,复制出来,执行得到不一样的结果;

ak:

XV3XYCZGKBJHWYUVTSBJ

 

sk:

KWz9szTqjnOYQ4idMFVi7GTD0YIMxNe6nfbSlMbY

projectId:

82f23886154841c094a2bb7b675aac99
生成的代码
 
<?php
namespace HuaweiCloud\SDK\IoTDA\V5\Model;
require_once "vendor/autoload.php";
use HuaweiCloud\SDK\Core\Auth\BasicCredentials;
use HuaweiCloud\SDK\Core\Http\HttpConfig;
use HuaweiCloud\SDK\Core\Exceptions\ConnectionException;
use HuaweiCloud\SDK\Core\Exceptions\RequestTimeoutException;
use HuaweiCloud\SDK\Core\Exceptions\ServiceResponseException;
use HuaweiCloud\SDK\IoTDA\V5\IoTDAClient;

// The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
// In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
$ak = getenv('CLOUD_SDK_AK');
$sk = getenv('CLOUD_SDK_SK');
$endpoint = "https://iotda.cn-north-4.myhuaweicloud.com";
$projectId = "82f23886154841c094a2bb7b675aac99";
$credentials = new BasicCredentials($ak,$sk,$projectId);
$config = HttpConfig::getDefaultConfig();
$config->setIgnoreSslVerification(true);

$client = IoTDAClient::newBuilder(new IoTDAClient)
  ->withHttpConfig($config)
  ->withEndpoint($endpoint)
  ->withCredentials($credentials)
  ->build();
$request = new ListDevicesRequest();
$response = $client->ListDevices($request);

建议方案:

 

 

yd_240151632 yd_240151632 发布于 2024-06-06 12:26:58 2024-06-06

785 1

0%
0人赞同
0%
0人不赞同

全部评论(1

评论(1

  • 【云声小管家】 子规 2024-06-06 17:38:25

    非常感谢您的反馈,您的问题已移交至专业工程师进行对接,可通过链接查看:https://console.huaweicloud.com/ticket/?region=cn-north-4&locale=zh-cn#/ticketindex/serviceTickets,紧急情况下可以拨打4000-955-988进行求助。
    若有关于华为云的抱怨、不满、问题、投诉、产品建议等,可通过云声平台提出,我们会尽快确认并给您回复,再次感谢您的支持与关注!

登录后可评论,请 注册

0/1000

+ 插入图片0/4

仅支持JPG、JPEG、PNG、GIF,数量不超过4张且每张大小不超过2MB

评论
发表评论...
取消 发表

0/1000

评论成功

+ 插入图片0/4

仅支持JPG、JPEG、PNG、GIF,数量不超过4张且每张大小不超过2MB

删除建议

设置昵称

在此一键设置昵称,即可发表云声建议!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。