ActiveCollab API v1无法更改项目的hourly_rates



我无法通过API(使用JavaScript/GoogleScript(更改项目或客户端对象的小时_日期

var responseObject = [];
var payload = {
"name": "Test project 125",
"hourly_rates": {"45": 222}
}
var response = UrlFetchApp.fetch("https://app.activecollab.com/218040/api/v1/projects", {
"method": "post",
"headers": {
'X-Angie-AuthApiToken': api_token
},
"payload" : payload,   
"followRedirects" : true,
"muteHttpExceptions": true
});
if (response.getResponseCode() == 200) {
responseObject = JSON.parse(response.getContentText());
}
console.log(responseObject);

退货:

hourly_rates={45=100, 24=20, 3=100, 38=50, 17=15, 31=50, 10=100}

如果我使用PUT方法,我会得到同样的结果。其他东西都省了,但小时费率却没有。

您尝试过ActiveCollab SDK吗?我不确定你的目标是哪家公司或哪种工作类型。

从git下载包后,运行composer update

这里有一个例子:

<?php
/*
* This library is free software, and it is part of the Active Collab SDK project. Check LICENSE for details.
*
* (c) A51 doo <info@activecollab.com>
*/
require_once __DIR__ . '/vendor/autoload.php';
$authenticator = new ActiveCollabSDKAuthenticatorCloud('ACME Inc', 'My Awesome Application', 'YOUR-EMAIL', 'YOUR-PASSWORD');
// Show all Active Collab 5 and up account that this user has access to
print_r($authenticator->getAccounts());
// Show user details (first name, last name and avatar URL)
print_r($authenticator->getUser());
// Issue a token for account #123456789
$token = $authenticator->issueToken(176178);
if ($token instanceof ActiveCollabSDKTokenInterface) {
print $token->getUrl() . "n";
print $token->getToken() . "n";
} else {
print "Invalid responsen";
die();
}
// Create a client instance
$client = new ActiveCollabSDKClient($token);
// Make a request
print_r($client->get('/job-types/5')->getJson());
try {
$client->put('/job-types/5', [
'single' => [
'default_hourly_rate' => 300
]
]);
} catch(AppException $e) {
print $e->getMessage() . '<br><br>';
}

这是一个如何直接更改小时费率的示例,您可以从/projects/ID-OF-THE-PROJECT中进行更改

请参阅API文件:https://developers.activecollab.com/api-documentation/v1/people/companies/custom-hourly-rates.html

最新更新