如何使用 shutterstock API 以简单的方式搜索和获取照片



我正在制作一个允许用户搜索并发送以打印Shutterstock照片的网站 像这个: https://wallprint.ee/

我正在遵循 Shutterstock API 文档并尝试使用它来连接、搜索和挑选照片: https://github.com/shutterstock/php-shutterstock-api

这是最好和最简单的方法吗?

这就是我现在正在尝试的方式:

<?php
require_once __DIR__ . '/vendor/autoload.php';
$clientId = '***';
$clientSecret = '****';
$client = new ShutterstockApiClient($clientId, $clientSecret);
var_dump($client);
// perform an image search for puppies
$client->get('images/search', array('query' => 'puppies'));
$imageResponse = $client->get('images', array('id' => array(1, 2, 3)));
if ($imageResponse->getStatusCode() != 200) {
// error handler
}
$images = $imageResponse->getBody()->jsonSerialize()['data'];
// etc

我期望:
内容得到某种响应.
我得到了

客户端错误:GET https://api.shutterstock.com/v2/images?id=1&id=2&id=3导致403 Forbidden响应:{"消息":"您无权访问此路由。请联系 api@shutterstock.com 了解更多信息"}

我读到,因为我使用"get", 我被告知免费的APP不能使用get: https://developers.shutterstock.com/documentation/authentication#accounts-and-limitations。 我已经写过 api@shutterstock.com 了。

但是,我有什么选择可以以最简单和无痛的方式开发它呢?

我是Errol,我在Shutterstock从事API工作。通常,你将收到此错误,因为你的应用无权调用该路由。

不幸的是,如果没有与Shutterstock的印刷合作伙伴关系,就没有其他选择来实现墙印正在做的事情。我们希望您能够访问所需的API端点,以便像您这样的开发人员可以创建出色的应用程序,但是,它需要以不违反Shutterstock许可或服务条款的方式完成。

如果您对此有任何疑问或疑虑,请给我们留言 api@shutterstock.com

最新更新