【发布时间】:2016-01-19 06:36:39
【问题描述】:
如何在 GAE 中使用 rest API(php 代码)在 pull queue 中插入数据
我正在关注以下链接 https://cloud.google.com/appengine/docs/python/taskqueue/rest/tasks/insert 我的代码是
$target_url = 'https://content.googleapis.com/taskqueue/v1beta2/projects/s~<projectname>/taskqueues/<task_queue_name>/tasks?key=<Server key >&alt=json';
$post = array('queueName' => '<task_queue_name>', 'payloadBase64'=>'aGVsbG8=');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$target_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
$post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
print_r($server_output);
curl_close ($ch);
但是我不能在拉队列中插入数据,请帮帮我
我也配置了queue.yaml,在这里设置ACL
结果
{ "error": { "errors": [ { "domain": "global", "reason": "required", “消息”:“需要登录”,“locationType”:“标题”,“位置”: "授权" } ], "code": 401, "message": "需要登录" } }
【问题讨论】:
标签: php python api rest google-app-engine