LANG SELRCT

Apps Script Reference  (Create: Create new Spreadsheet | Create new Apps Script

Saturday, August 31, 2019

zendeskで特定日以降のチケットをAPIで取得したい


zendeskにログイン状態でブラウザでAPIをたたいてみました。

https://EXAMPLE.zendesk.com/api/v2/search.json?page=1&query=created>2019-01-01 type:ticket

  • 「EXAMPLE」の部分は使用しているzendeskの名前に変更します
  • 「%3E」は「>」を意味します
  • 「%20」は半角スペースを意味します
  • page=1 を page=2 などに変更すると検索結果が複数ページにまたがる場合に次のページの結果を取得できます



パラメータの書き方が最初よくわかりませんでしたが、おそらくこうなっている。

リクエスト
https://EXAMPLE.zendesk.com/api/v2/search.json?
page=1&
query=created%3E2019-01-01
意訳
EXAMPLEは各自の設定による名前
検索結果の1ページ目
created>2019-01-01


以下はトライアルでたたいた結果です。

レスポンス
{
    "results": [{
        "url": "https://EXAMPLE.zendesk.com/api/v2/tickets/2.json",
        "id": 2,
        "external_id": null,
        "via": {
            "channel": "web",
            "source": {
                "from": {},
                "to": {},
                "rel": null
            }
        },
        "created_at": "2019-08-31T02:35:25Z",
        "updated_at": "2019-08-31T02:35:25Z",
        "type": null,
        "subject": "テスト",
        "raw_subject": "テスト",
        "description": "テストです",
        "priority": null,
        "status": "open",
        "recipient": null,
        "requester_id": 386276247732,
        "submitter_id": 386276247732,
        "assignee_id": 386276247732,
        "organization_id": 360616460352,
        "group_id": 360005922532,
        "collaborator_ids": [],
        "follower_ids": [],
        "email_cc_ids": [],
        "forum_topic_id": null,
        "problem_id": null,
        "has_incidents": false,
        "is_public": true,
        "due_at": null,
        "tags": [],
        "custom_fields": [],
        "satisfaction_rating": null,
        "sharing_agreement_ids": [],
        "fields": [],
        "followup_ids": [],
        "brand_id": 360002806472,
        "allow_channelback": false,
        "allow_attachments": true,
        "result_type": "ticket"
    }],
    "facets": null,
    "next_page": null,
    "previous_page": null,
    "count": 1
}


参考

チケットの検索
https://support.zendesk.com/hc/ja/articles/203663206-%E3%83%81%E3%82%B1%E3%83%83%E3%83%88%E3%81%AE%E6%A4%9C%E7%B4%A2

Latest post

Extracting data from Google Sheets with regular expressions

Introduction Regular expressions are a powerful tool that can be used to extract data from text.  In Google Sheets, regular expressions ca...