我已经将图像文件上传到Dreamfactory的文件夹中
<img src="https://motodev.spotya.online/api/v2/files/Posts/posts_1508937621_Tulips.jpg">
显示错误,
{“错误”:{“代码”:400,“上下文”:null,“message”:“没有在请求中检测到会话令牌(JWT)或API键”}
发布于 2017-10-25 23:47:09
看起来,梦幻工厂中的files
端点是安全的。您需要提供API键或JWT令牌来访问该目录中的文件。另一种方法是将客户访问添加到您的files
端点,如描述的这里。
您需要生成像https://example.org/api/v2/files/image.jpg?api_key=<your api key>
这样的url。例如:
<?php
// your guest API key
$apiKey = 'your api key should be here';
// your file URL
$baseUrl = 'https://example.org/api/v2/files/image.jpg';
// resulted URL
$finalUrl = $baseUrl . http_build_query(['api_key' => $apiKey]);
?>
<img src="<?= $finalUrl ?>">
https://stackoverflow.com/questions/46948477
复制