コール
6. 発送済み注文の取引先をタップし、フィードまでスワイプします。注文が発送 されたことをユーザに知らせるフィード項目が表示されます。
成功です。これで、作成したアクションを
REST API
コールで呼び出すようにShipify Web
アプリケーションを更新できました。もうひとこと : クイックアクションと REST API
REST API
には、アクションの操作時に使用できるリソースとコールがいくつか含まれています。
Quick Actions
Quick Actions
リソースは、アクションと、フィードに表示されるカスタム項目およびオブジェクトのリストを返すために使用します。リソースでは、
services/data/v34.0/quickActions/形式の URI が使用されます。
SalesforceAPI
の操作に特定のツールを使用しているユーザもいます。好みのツールがない場合、ワークベンチを使用すれば簡単に始めることができます。ワークベンチにつ
いての詳細は、https://developer.salesforce.com/page/Workbenchを参照してください。
REST API
についての詳細は、『Force.com REST API開発者ガイド』を参照してください。グローバルアクション
グローバルアクションを返すには、services/data/v34.0/quickActions/を 使用します。
このリソースへのコールでは、次の応答のスニペットに示すように、
Shipify
キャン バスカスタムアクションを含む、グローバルアクションに関する情報が返されま す。...
{
"urls" : {
"quickAction" : "/services/data/v34.0/
quickActions/LogACall",
"defaultValues" : "/services/data/v34.0/
quickActions/LogACall/defaultValues",
"describe" : "/services/data/v34.0/
quickActions/LogACall/describe"
},
"name" : "LogACall",
"type" : "LogACall",
"label" : "Log a Call"
}, {
"urls" : {
"quickAction" : "/services/data/v34.0/
quickActions/Shipify",
"describe" : "/services/data/v34.0/
quickActions/Shipify/describe"
},
"name" : "Shipify",
"type" : "Canvas",
"label" : "Shipify"
}, ...
オブジェクトアクション
グローバルアクションだけでなく特定のオブジェクトのアクションを返すには、
services/data/v34.0/sobjects/object/quickActions/を使用します。
/services/data/v34.0/sobjects/Invoice__c/quickActionsコールでは、
次の応答のスニペットに示すように、グローバルアクションおよび請求書の Create_Deliveryアクションに関する情報が返されます。
...
{ "urls" : {
"quickAction" : "/services/data/v34.0/
quickActions/Shipify",
"describe" : "/services/data/v34.0/
quickActions/Shipify/describe"
},
"name" : "Shipify",
"type" : "Canvas",
"label" : "Shipify"
}, {
"urls" : {
"defaultValuesTemplate" : "/services/data/v34.0/
sobjects/Invoice__c/quickActions/Create_Delivery/
defaultValues/{ID}",
"quickAction" : "/services/data/v34.0/
sobjects/Invoice__c/quickActions/Create_Delivery",
"defaultValues" : "/services/data/v34.0/
sobjects/Invoice__c/quickActions/Create_Delivery/
defaultValues",
"describe" : "/services/data/v34.0/
sobjects/Invoice__c/quickActions/Create_Delivery/
describe"
},
"name" : "Invoice__c.Create_Delivery",
"type" : "Create",
"label" : "Create Delivery"
},
特定のアクション
特定のアクションを返すには、
services/data/v34.0/sobjects/object/quickActions/Action_Nameを使 用します。
/services/data/v34.0/sobjects/Invoice__c/
quickActions/Create_Deliveryコールでは、次の応答に示すように、
Create_Deliveryアクションに関する情報のみが返されます。
{
"colors": [ {
"theme": "theme4",
"color": "AA8E0A",
"context": "primary"
}, {
"theme": "theme3",
"color": "AA8E0A",
"context": "primary"
} ],
"miniIconUrl": "https://instance.salesforce.com/img/
icon/custom51_100/truck16.png",
"sourceSobjectType": "Invoice__c",
"targetParentField": "Invoice__c",
"targetRecordTypeId": null,
"targetSobjectType": "Delivery__c",
"visualforcePageName": null,
"iconUrl": "https://instance.salesforce.com/img/
icon/custom51_100/truck32.png",
"iconName": null,
"canvasApplicationName": null,
"height": null,
"icons" : [ ], ...
"layout": {
"layoutRows": [{
"layoutItems": [ {
"layoutComponents": [{
"details": {
"namePointing": false,
"custom": true,
"htmlFormatted": false,
"dependentPicklist": false,
"calculatedFormula": null,
"defaultValueFormula": null,
"defaultedOnCreate": false,
"digits": 0,
"groupable": true,
"permissionable": false,
"referenceTo": ["Invoice__c"],
"relationshipOrder": 0,
"soapType": "tns:ID",
"nameField": false,
"sortable": true,
"filterable": true,
"restrictedPicklist": false,
"caseSensitive": false,
"calculated": false,
"scale": 0,
"nillable": false,
"externalId": false,
"idLookup": false,
"controllerName": null,
"deprecatedAndHidden": false,
"inlineHelpText": null,
"writeRequiresMasterRead": false,
"createable": true,
"updateable": false,
"relationshipName": "Invoice__r",
"autoNumber": false,
"unique": false,
"picklistValues": [],
"displayLocationInDecimal": false,
"cascadeDelete": true,
"restrictedDelete": false,
"length": 18,
"name": "Invoice__c",
"type": "reference",
"defaultValue": null,
"byteLength": 18,
"label": "Invoice",
"precision": 0 },
"displayLines": 1,
"tabOrder": 1,
"value": "Invoice__c",
"type": "Field"
}],
"placeholder": false,
"editable": true,
"required": true,
"label": "Invoice"
}, {
"layoutComponents": [],
"placeholder": true,
"editable": false,
"required": false,
"label": ""
} ],
"numItems": 2 }],
"useCollapsibleSection": false,
"useHeading": false,
"columns": 2,
"heading": null,
"rows": 1 },
"defaultValues": [],
"width": null,
"urls": {
"defaultValuesTemplate": "/services/data/v34.0/
sobjects/Invoice__c/quickActions/
Create_Delivery/defaultValues/{ID}",
"quickAction": "/services/data/v34.0/
sobjects/Invoice__c/quickActions/Create_Delivery",
"defaultValues": "/services/data/v34.0/
sobjects/Invoice__c/quickActions/
Create_Delivery/defaultValues",
"describe": "/services/data/v34.0/
sobjects/Invoice__c/quickActions/
Create_Delivery/describe"
},
"name": "Invoice__c.Create_Delivery",
"type": "Create",
"label": "Create Delivery"
}
アクションの詳細
特定のアクションの説明の詳細を返すには、
services/data/v34.0/sobjects/object/quickActions/Action_Name/describe/
を使用します。
アクションのデフォルト値と項目値
デフォルトの項目値を含む、特定のアクションのデフォルト値を返すには、
services/data/v34.0/sobjects/object/quickActions/Action_Name/defaultValues/
を使用します。
/services/data/v34.0/sobjects/Invoice__c/
quickActions/Create_Data/defaultValuesコールでは、次の応答のスニペッ トに示すように、請求書のCreate_Deliveryアクションのデフォルトに関する 情報が返されます。
...
{
"attributes":{
"type":"Delivery__c"
} } ...
アクションのデフォルト値
アクションのデフォルト値を返すには、/services/data/v34.0/subjects/
object/quickActions/Action_Name/defaultValues/Parent_IDを使用しま す。
Describe Layouts
Global Describe Layouts
リソースは、アクションオブジェクトを含む、オブジェクトのグローバルレイアウト情報を取得するために使用します。このリソースでは、
services/data/v34.0/ sobjects/Global/describe/layouts/形式の
URI
が使 用されます。このリソースへのコールでは、次の応答に示すように、グローバルアクション
(Shipify
キャンバスカスタムアクションを含む)
のレイアウト情報が返されます。{
"recordTypeSelectorRequired":[
false ],
"recordTypeMappings":[
],
"layouts":[
{
"relatedLists":[
],
"relatedContent":null,
"detailLayoutSections":[
],
"editLayoutSections":[
],
"multirowEditLayoutSections":[
],
"offlineLinks":[
],
"buttonLayoutSection":null,
"highlightsPanelLayoutSection":null,
"quickActionList":{
"quickActionListItems":[
{
"quickActionName":"Shipify",
"colors":[
],
"miniIconUrl":null,
"targetSobjectType":null,
"iconUrl":null,
"urls":{
"quickAction":"/services/data/v34.0/
quickActions/Shipify",
"describe":"/services/data/v34.0/
quickActions/Shipify/describe"
},
"icons":[
],
"type":"Canvas",
"label":"Shipify"
}, {
"quickActionName":"FeedItem.TextPost",
"colors":[
],
"miniIconUrl":null,
"targetSobjectType":null,
"iconUrl":null,
"urls":{
},
"icons":[
],
"type":"Post",
}, {
"quickActionName":"FeedItem.ContentPost",
"colors":[
],
"miniIconUrl":null,
"targetSobjectType":null,
"iconUrl":null,
"urls":{
},
"icons":[
],
"type":"Post",
"label":"File"
}, {
"quickActionName":"NewTask",
"colors":[
{
"color":"44A12C",
"theme":"theme4",
"context":"primary"
}, {
"color":"1797C0",
"theme":"theme3",
"context":"primary"
} ],
"miniIconUrl":"https://instance.
salesforce.com/img/icon/tasks16.png",
"targetSobjectType":"Task",
"iconUrl":"https://instance.
salesforce.com/img/icon/home32.png",
"urls":{
"quickAction":"/services/data/v34.0/
quickActions/NewTask",
"defaultValues":"/services/data/v34.0/
quickActions/NewTask/defaultValues",
"describe":"/services/data/v34.0/
quickActions/NewTask/describe"
},
"icons":[
{
"url":"https://instance.
salesforce.com/img/icon/home32.png",
"height":32,
"theme":"theme3",
"width":32,
"contentType":"image/png"
}, {
"url":"https://instance.
salesforce.com/img/icon/tasks16.png",
"height":16,
"theme":"theme3",
"width":16,
"contentType":"image/png"
}, ...
],
"type":"Create",