是否仍然可以使用 Itunes Connect API 端点而不是 Java Reporter 工具?
Is it still possible to use Itunes Connect API endpoints instead of Java Reporter tool?
在最新的 Itunes Connect 更新之前,所有请求都是通过我们应用程序中的 Curl 发出的 HTTP 请求。更新后,Apple 推荐使用他们的新记者工具。
https://github.com/mikebarlow/itc-reporter 如果可能的话,我想做类似的事情。这应该可以在没有报告工具的情况下工作,看起来它仍然只是在发出 HTTP 请求。我不会在我的项目中使用此代码,因为它需要我们更新我们计划在另一时间更新的 PHP 版本。
是否可以使用 Curl 发出简单的 HTTP 请求来获取数据?如果不需要,我不想使用 Guzzle!
$json = '{"userid":"{{USERNAME}}","password":"{{PASSWORD}}","version":"2.0","mode":"Robot.XML","account":"{{VENDOR_ID}}","queryInput":"[p=Reporter.properties, Sales.getReport, {{VENDOR_ID}},Sales,Summary,Weekly,20170108]"}'
CURLOPT_URL => 'https://reportingitc-reporter.apple.com/reportservice/sales/v1',
CURLOPT_HEADER => false,
CURLOPT_HTTPHEADER => array('Accept: text/xml, text/plain', 'Content-Type: text/xml, text/plain'),
CURLOPT_USERAGENT => 'Java/1.8.0_92',
CURLOPT_TIMEOUT => 10,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $json,
这是我在测试时提出的请求,当我 运行 它时,我得到 HTML 响应说 "Forbidden, You do not have access to this page"
我在对用户名和密码进行 urlencoding 时尝试了此操作,但得到了相同的结果。我希望仍然能够使用 Curl 获取这些数据,否则我们将不得不努力将报告工具添加到我们的应用程序中。
只需要相应地更改后域
function build_json_request(, $access_token, $account_id,
$args_arr=array())
{
$args = $args_arr;
$json = array(
'accesstoken' => urlencode($access_token),
'version' => '2.2',
'mode' => 'Robot.XML',
'account' => $account_id
);
$queryInput = array(
'p=Reporter.properties',
array_shift($args)
);
if(! empty($args))
$queryInput[] = implode(',', $args);
$json['queryInput'] = '[' . implode(', ', $queryInput) . ']';
return json_encode($json);
}
$json = build_json_request('Sales.getReport', $access_token, $account_id, array('Sales.getReport', $vendor_id, 'Sales', 'Summary', 'Daily', $date) );
$output = process_curl(array(
CURLOPT_URL => 'https://reportingitc-reporter.apple.com/reportservice/sales/v1',
CURLOPT_HEADER => false,
CURLOPT_TIMEOUT => 10,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => 'jsonRequest='.$json,
));
在最新的 Itunes Connect 更新之前,所有请求都是通过我们应用程序中的 Curl 发出的 HTTP 请求。更新后,Apple 推荐使用他们的新记者工具。
https://github.com/mikebarlow/itc-reporter 如果可能的话,我想做类似的事情。这应该可以在没有报告工具的情况下工作,看起来它仍然只是在发出 HTTP 请求。我不会在我的项目中使用此代码,因为它需要我们更新我们计划在另一时间更新的 PHP 版本。
是否可以使用 Curl 发出简单的 HTTP 请求来获取数据?如果不需要,我不想使用 Guzzle!
$json = '{"userid":"{{USERNAME}}","password":"{{PASSWORD}}","version":"2.0","mode":"Robot.XML","account":"{{VENDOR_ID}}","queryInput":"[p=Reporter.properties, Sales.getReport, {{VENDOR_ID}},Sales,Summary,Weekly,20170108]"}'
CURLOPT_URL => 'https://reportingitc-reporter.apple.com/reportservice/sales/v1',
CURLOPT_HEADER => false,
CURLOPT_HTTPHEADER => array('Accept: text/xml, text/plain', 'Content-Type: text/xml, text/plain'),
CURLOPT_USERAGENT => 'Java/1.8.0_92',
CURLOPT_TIMEOUT => 10,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $json,
这是我在测试时提出的请求,当我 运行 它时,我得到 HTML 响应说 "Forbidden, You do not have access to this page"
我在对用户名和密码进行 urlencoding 时尝试了此操作,但得到了相同的结果。我希望仍然能够使用 Curl 获取这些数据,否则我们将不得不努力将报告工具添加到我们的应用程序中。
只需要相应地更改后域
function build_json_request(, $access_token, $account_id,
$args_arr=array())
{
$args = $args_arr;
$json = array(
'accesstoken' => urlencode($access_token),
'version' => '2.2',
'mode' => 'Robot.XML',
'account' => $account_id
);
$queryInput = array(
'p=Reporter.properties',
array_shift($args)
);
if(! empty($args))
$queryInput[] = implode(',', $args);
$json['queryInput'] = '[' . implode(', ', $queryInput) . ']';
return json_encode($json);
}
$json = build_json_request('Sales.getReport', $access_token, $account_id, array('Sales.getReport', $vendor_id, 'Sales', 'Summary', 'Daily', $date) );
$output = process_curl(array(
CURLOPT_URL => 'https://reportingitc-reporter.apple.com/reportservice/sales/v1',
CURLOPT_HEADER => false,
CURLOPT_TIMEOUT => 10,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => 'jsonRequest='.$json,
));