コメントAPI
コメントAPIを使用して、Coupa文書のコメントを作成、表示、更新します。
概要
契約条件にアクセスするためのURLは次のとおりです。 https ://<instance>/api/comments また、URLの末尾に /attachments を追加することで、コメントに添付ファイルを含めることもできます。 制限については、以下の警告を参照してください。
アクション
コメントを取得または投稿するには、データをプルするオブジェクトのAPIを使用し、URLの末尾に /comments を追加します。次のようになります。
/api/{transactional_object}/{object_id}/comments
GET呼び出しを使用すると、文書のすべてのコメントが取得され、POST呼び出しで新しいコメントが追加されます。
コメントは、ペイロードが適切に取得または投稿するために必要な /api/commentsを使用して追加することもできます。
コメントAPIでは以下の操作が可能です。
| 動詞 | パス | アクション | Description |
|---|---|---|---|
| POST | /api/invoices/:invoice_id/comments | 作成 | コメントを作成 |
| POST | /api/expense_reports/:expense_report_id/comments | 作成 | コメントを作成 |
| POST | /api/purchase_orders/:purchase_order_id/comments | 作成 | コメントを作成 |
| POST | /api/users/:user_id/comments | 作成 | コメントを作成 |
| POST | /api/requisitions/:requisition_id/comments | 作成 | コメントを作成 |
| GET | /api/invoices/:invoice_id/comments | インデックス | コメントを照会 |
| GET | /api/expense_reports/:expense_report_id/comments | インデックス | コメントを照会 |
| GET | /api/purchase_orders/:purchase_order_id/comments | インデックス | コメントを照会 |
| GET | /api/users/:user_id/comments | インデックス | コメントを照会 |
| GET | /api/requisitions/:requisition_id/comments | インデックス | コメントを照会 |
| GET | /api/invoices/:invoice_id/comments/:id | 表示 | コメントを表示 |
| GET | /api/expense_reports/:expense_report_id/comments/:id | 表示 | コメントを表示 |
| GET | /api/purchase_orders/:purchase_order_id/comments/:id | 表示 | コメントを表示 |
| GET | /api/users/:user_id/comments/:id | 表示 | コメントを表示 |
| GET | /api/requisitions/:requisition_id/comments/:id | 表示 | コメントを表示 |
- /api/comments/{invalid comment id}/attachmentsとしてネストされたループを持つエンドポイントに無効なIDを渡すと、エアブレーキが発生し、他のオブジェクトでも同じです。
- URLタイプの添付ファイルIDをエンドポイント/api/comments/{comment id}/attachments/{URLタイプの添付ファイルID}に渡して特定の添付ファイルを表示すると、次のエラーが表示されます:添付ファイルにファイルが添付されていません
Elements
コメントAPIでは、次の要素を使用できます。
| 要素 | Description | 必須フィールド? | 一意? | 許容値 | Api - Inフィールド? | Api - Outフィールド? | データタイプ |
|---|---|---|---|---|---|---|---|
| attachments | attachments | yes | 該当なし | ||||
| commentable-id | commentable-id | yes | yes | 整数 | |||
| commentable-type | commentable-type | yes | yes | string(255) | |||
| comment-type | コメントのタイプを示し、社内でのみ使用されます | string(255) | |||||
| コメント | 投稿したいコメントです。 コメントフィールドに @[ User:{id}] を含めることで、ユーザーをメンションできます。 | yes | yes | テキスト | |||
| 作成日時 | CoupaがYYY-MM-DDTHH:MM:SS+HH:MMZの形式で自動的に作成します | yes | datetime | ||||
| created-by | コメントを作成したユーザーです。 | yes | ユーザー | ||||
| ID | ユーザーのCoupaの一意の識別子です。 | yes | 整数 | ||||
| reason-code | コメント理由コード | yes | string(255) | ||||
| to-supplier | サプライヤーに表示しますか? | yes | boolean | ||||
| updated-at | CoupaがYYY-MM-DDTHH:MM:SS+HH:MMZの形式で自動的に作成します | yes | datetime | ||||
| updated-by | 更新したユーザー | yes | ユーザー |
例: POST呼び出し
<comment> <commentable-id type="integer">123456</commentable-id> <commentable-type>InvoiceHeader</commentable-type> <comments>コメントテキスト</comments> </comment><comment> <commentable-id type="integer">123456</commentable-id> <commentable-type>InvoiceHeader</commentable-type> <comments>@ [ユーザー: 2]このコメントを参照してください</comments> </comment>