次のSDKメソッドを呼び出す前に、JSファイル https://js.zohocdn.com/projects/js/client_sdk.min.jsをコードに含めてください。
Zoho BugTrackerのスタイルを使用するには、CSSファイル https://css.zohocdn.com/projects/styles/zps-extn/client_sdk.cssをコードに含めてください。
拡張機能を初期化します。
zohobugtracker.init().then(function(){});
他のSDKメソッドはこのメソッドの呼び出し後にのみ動作するため、最初にこのメソッドを呼び出す必要があります。initの読み込み中に他の関数を使用する場合は、init関数内で使用できます。
zohobugtracker.init().then(function () {
zohobugtracker.get('portal.name').then(function (response)
});
拡張機能の支払い情報と設定情報を取得します。
zohobugtracker.metadata().then(function(response) {/* output { 'data': { 'configs': [ { 'name': 'Name', 'type': 'text', 'is_mandatory': true, 'is_secure': false, 'description': 'Enter your name', 'value': 'Helen Collins' }, { 'name': 'Employee ID', 'type': 'text', 'is_mandatory': true, 'is_secure': false, 'description': 'Enter your Emp. ID', 'value': 'EMP08' } ], 'payments_info': { 'edition': 'trial' }, 'status': 'success' } } */ }); });
現在の場所のタブ名とエンティティIDを取得します。タブ名は「bugs」で、エンティティIDは該当するバグのIDです。
zohobugtracker.context().then(function(response)
{
/* output
{
'module_name': 'bugs',
'entity_id': '27092000000031079'
}
*/
});
現在の場所のインスタンス、現在のユーザー、ポータル、プロジェクト、バグの詳細を取得します。
zohobugtracker.get('bug.id').then(function(response)
{
/* output
{
'data': 27092000000031080,
'status': 'success'
}
*/
});
getメソッドで使用できるキーの一覧は次のとおりです。
アップロード待ちのキューにあるファイルはchosen_filesに保存されます。このキーは、添付ファイルピッカーでのみサポートされています。
現在のデータセンターを取得します。
zohobugtracker.get('deployment_type').then(function() {
/* output
com
*/
});
ポータルレベルですべてのプロフィールを取得するキーと、現在のユーザーのプロフィール詳細を取得するキーがサポートされています。
Zoho BugTrackerでは、ポータルのテーマがサポートされています。
zohobugtracker.get('current_theme').then(function() {
/* output
{mode: 'default', zpPrimary: '255, 100, 0', zpPrimaryHover: '255, 247, 243'}
*/
});
現在の場所にある特定のバグの属性を更新します。
var nameObj={name:'Create a new checklist'};
zohobugtracker.set('task',nameObj).then(function(response)
{
/* output
{
'data': {
'tasks': [
{
'phase_id': '2*******************2',
'link': {
'timesheet': {
'url': 'https://p*************e.********.com/restapi/portal/5******7/projects/2****************9/tasks/2****************9/logs/'
},
'self': {
'url': 'https://p*************e.********.com/restapi/portal/5******7/projects/2****************9/tasks/2****************9/'
}
},
'description': '',
'duration': '0',
'last_updated_time_long': 1542193097398,
'details': {
'owners': [
{
'name': 'JOHN MARSH',
'id': '5************3'
}
]
},
'id': 2************0,
'key': 'WEUT-T1',
'created_person': 'Steve Banks',
'created_time_long': 1525668983347,
'created_time': '05-07-2018',
'is_reminder_set': false,
'is_recurrence_set': false,
'created_time_format': '05-07-2018 10:26:23 AM',
'subtasks': false,
'work': '0:00',
'custom_fields': [
{
'column_name': 'UDF_LONG1',
'label_name': 'Expense Amount',
'value': '24573'
},
{
'column_name': 'UDF_LONG3',
'label_name': 'sample',
'value': '0'
},
{
'column_name': 'UDF_LONG2',
'label_name': 'test',
'value': '200'
}
],
'isparent': false,
'work_type': 'work_hrs_per_day',
'completed': false,
'priority': 'None',
'created_by': '5******3',
'percent_complete': '0',
'last_updated_time': '11-14-2018',
'name': 'Create a new checklist',
'id_string': '2************9',
'last_updated_time_format': '11-14-2018 04:28:17 PM',
'tasklist': {
'name': 'General',
'id': '2************7'
},
'order_sequence': 1,
'status': {
'name': 'Open',
'id': '2************1',
'type': 'open',
'color_code': ''
}
}
]
},
'status': 'success'
}
*/
});
バグのsetメソッドでは、次のキーを使用できます。
プロジェクトを更新するsetメソッドでは、次のキーを使用できます。
フェーズを更新するsetメソッドでは、次のキーを使用できます。
linkfilesキーを使用して、ファイルを現在の場所に関連付けます。このキーは、次の場所に対応しています:課題の詳細タブ、添付ファイルピッカー。最大サイズ10の配列である必要があり、次の項目は必須です:id、name、type、permanent_url、download_url、size、created_by、created_time。画像ファイルの場合、preview_urlは必須です。
linkfiles=[{
'created_time': 1561028014712,
'id': '1LavBS5sauJ-AAFJZWp8Ch9Cp2ehydahk',
'type': 'image/jpeg',
'created_by': 'Patricia Boyle',
'permanent_url': 'https://***************',
'size': 7409,
'preview_url': 'https://******************',
'name': 'sample-image.jpeg',
'download_url': 'https://drive.google.com/a/web-mailhosting.com/uc?id=1LavBS5sauJ-AAFJZWp8Ch9Cp2ehydahk&エクスポート=download',
}]
zohobugtracker.set('linkfiles', linkFiles).then(function (response) {
zohobugtracker.invoke('attachment_picker.close');
});
plugin-manifest.jsonファイルで定義された接続を使用して、拡張機能からサードパーティのURLを呼び出します。接続リンク名が指定されていない場合、入力内容に基づいてレスポンスが返されます。
var file = document.getElementById('inputbox').files[0];
var file_detail = {
type: 'GET',
files: [{
uploaddoc : file
type : 'binary' //If the file is uploaded as binary
}],
parameters: {
fields: 'id,name, thumbnailLink, webViewLink, webContentLink'
}
};
var url = 'https://www.googleapis.com/drive/v3/files/1-QabBt69U8myXYRDVU-1YiCo2k-JWRfu';
zohobugtracker.request(url, file_detail, 'google_drive').then(function (response)
/* Output
{
'result': {
'webContentLink': 'https://drive.google.com/uc?id=1-QabBt69U8myXYRDVU-1YiCo2k-JWRfu&エクスポート=download',
'name': 'Eiffel_Tower_01.jpg',
'webViewLink': 'https://drive.google.com/file/d/1-QabBt69U8myXYRDVU-1YiCo2k-JWRfu/view?usp=drivesdk',
'id': '1-QabBt69U8myXYRDVU-1YiCo2k-JWRfu',
'thumbnailLink': 'https://lh3.googleusercontent.com/nhyq9mHrGDOZfNdQUHRj_xVlOoNAP5PEYkW4X2svGXKjVt53MvMGfjhQ2PlTv4cmv5-PgbjrR-c=s220'
},
'status': 'success'
}
*/
});
| 引数名 | データ型 | 説明 | ||
| URL | string | 拡張機能から呼び出す必要があるサードパーティのURL。 | ||
| object | JSONObject | キー | データ型 | 値 |
| type | string | 'GET'/'POST'/'PUT'/'削除'/'PATCH' | ||
| parameters | JSONObject | APIの要求パラメーター。 | ||
| headers | JSONObject | APIのヘッダー。 | ||
| body | JSONObject |
APIの本文。
|
||
| files | JSONArray |
ファイルをアップロードするためのパラメーター。 値:実際のファイル。 *実際のファイルがアップロードされた場合、本文は無視されます *typeにbinaryを指定すると、ファイルはバイナリーとして送信されます。ファイルの本文も考慮されます |
||
| replace_secure_config | Boolean |
plugin-manifest.jsonファイルのis_secureパラメーターがtrueの場合、このパラメーターの値をtrueに設定します。 Zoho BugTrackerがURL内の値を置き換えます。 メモ:初期値はfalseです。 |
||
| connection_link_name | string | zapps Webサイトから生成された接続リンク名。 |
||