使用 RESTful 服務存取 Oracle Sales Automation 資料

Oracle Sales Automation 提供數個 RESTful API,可用來存取標準和自訂物件資料,以及與外部應用程式整合。RESTful 直接方法呼叫是透過 HTTP 協定使用結構化正確 URL 進行。

每個 API 都包含標準 Oracle Sales Automation 物件,而每個物件都與 REST 資源資源集合相關聯。例如,在 RESTful API 中,Opportunities 資源端點是用來追蹤潛在銷售的相關資訊。不過,在使用 Oracle Sales Automation RESTful Web 服務之前,您必須考慮取得存取權的安全需求,以及識別要使用的 Web 服務,以及其對應的支援方法與預期有效負載結構。

關於 Oracle Sales Automation RESTful API 中的資源

Oracle Sales Automation 為標準與自訂物件提供一組 REST 資源。

任何 RESTful API 的重要概念就是資源。資源是具有類型 (例如商機 )、相關資料、與其他資源的關係,以及一組在其上操作的方法的物件。這些資源以階層方式組織,包括:

  • 根資源:對應至邏輯物件,例如「機會」或「潛在客戶」。

  • 子資源:這些是屬於上階資源的資源,例如機會的聯絡人。

  • 值清單資源:設定欄位值時可使用的有效值清單。有兩種類型:「查閱」(靜態清單) 或「動態」(根據環境定義)。

Oracle Sales Automation RESTful API 中,有兩種資源類型:單一資源或集合資源。單一資源可以代表單一實體 (例如員工或採購單),而收集資源可以更全面,例如員工清單或可分頁的採購單清單。

關於自訂物件的 REST 支援

Oracle Sales Automation 包含適用於許多業務需求與案例的標準物件。不過,除了標準物件之外,如果您有獨特的業務需求,可以使用「應用程式編寫器」工具來建立最上層自訂物件與下階自訂物件。

「應用程式編寫器」是一種瀏覽器型工具,業務分析師和管理員 (不只是開發人員) 可以用來自訂 Oracle Sales Automation 。透過使用此工具,您可以進行過去僅由開發人員進行的資料模型變更類型。在「應用程式編寫器」工具中,您可以即時進行變更,並立即可供使用而不需重新登入應用程式,這包括建立自訂物件 (可新增至 Oracle Sales Automation RESTful API)。

Performance Tips - 效能提示

若要從 Oracle Fusion Sales Cloud REST API 取得最佳效能,請遵循這些提示。

僅查詢您需要的資料。例如,如果您查詢機會 REST 服務,有效負載將會很大,而且回應時間會很長。您可以在下列情況下縮短此回應時間:
  • 只查詢您需要的資料。
  • 僅查詢資料,而非中繼資料。
例如,輸入查詢
salesApi/resources/latest/opportunities
將會傳回大型有效負載,而輸入查詢
salesApi/resources/latest/opportunities?fields=Name,OptyNum&onlyData=true
將會,因為您已縮小查詢準則,傳回較小的有效負載。

使用「描述」端點搜尋 RESTful 資源

您可以傳送傳回包含資源資訊和補充中繼資料的 JSON 物件的 HTTP GET 要求,以取得不同 Oracle Sales Automation RESTful API 的特定詳細資料。

取得特定 API 版本的相關資訊:
  1. 以銷售管理員身分登入 Oracle Sales Automation
  2. 登入後顯示的 URL 顯示 Oracle Sales Automation 執行處理的伺服器名稱和連接埠號碼:
    例如,如果 URL 是 http://˂crm_server:PortNumber˃/customer/faces/CrmFusionHome,則伺服器名稱為 crm_server,連接埠號碼為 PortNumber

    記下您在其餘步驟中使用的伺服器名稱和連接埠號碼。

  3. 將 Web 瀏覽器指向 API 資源 URL,以取得 Oracle Sales Automation 執行處理的 API 中繼資料:

    https://˂crm_server:PortNumber˃/salesApi/resources/

    其中 salesAPI 是應用程式容器的 API 名稱。伺服器回應會傳回包含物件項目陣列的 JSON 物件,其中每個項目代表特定版本的 API;例如,以下是結果陣列的一部分,其中包含一個項目的相關資訊:

    {
        "version" : "11.1.10",
        "isLatest" : true,
        "links" : [ {
          "rel" : "self",
          "href" : " https://˂crm_server:PortNumber˃/salesApi/resources/11.1.10",
          "name" : "self",
          "kind" : "item"
        }, {
          "rel" : "canonical",
          "href" : " https://˂crm_server:PortNumber˃/salesApi/resources/11.1.10",
          "name" : "canonical",
          "kind" : "item"
        }, {
          "rel" : "predecessor-version",
          "href" : " https://˂crm_server:PortNumber˃/salesApi/resources/11.1.9",
          "name" : "predecessor-version",
          "kind" : "item"
        }, {
          "rel" : "describe",
          "href" : " https://˂crm_server:PortNumber˃/salesApi/resources/11.1.10/describe",
          "name" : "describe",
          "kind" : "describe"
        } ]
      }
  4. 若要查看特定 API 版本公開的所有物件,可以存取其「描述」端點,在 URL 中指定想要的版本:

    https://˂crm_server:PortNumber˃/salesApi/resources/11.1.10/describe

    或者,您也可以取得「最新」API 版本的相關資訊:

    https://˂crm_server:PortNumber˃/salesApi/resources/latest/describe

    這會傳回包含 API 支援之最新版本 Oracle Sales Automation 物件的長 JSON 物件、其下階物件、所有支援方法、參數、傳回值以及物件資源 URI 的完整描述。

搜尋與自訂物件關聯的 RESTful 資源

若要尋找 Oracle Sales Automation 自訂物件的資源 URI,請遵循下列步驟:

  1. 瀏覽至應用程式編寫器 (您必須以銷售管理員、CRM 應用程式管理員或應用程式導入顧問的身分登入)。
  2. 按一下自訂物件以檢視物件表格中的自訂物件清單。
  3. 若要檢視特定物件的 URI,請在 REST 資源資料欄中,按一下對應該物件的服務連結。

    秘訣:

    您可以從瀏覽器的網址列剪下並貼上 URI。

  4. (選擇性) 若要檢視特定自訂物件的描述,請在 REST 資源資料欄中,按一下對應至該物件的描述連結。

    附註:

    您可以在 URI 的結尾附加 /describe,以取得自訂物件的描述。

取得 RESTful Web 服務的服務端點

您可以在 API URL 中指定服務名稱而非關鍵字 "describe",來推斷 Oracle Sales Automation RESTful Web 服務端點的名稱。

首先,請遵循下列步驟:
  1. 開啟您的瀏覽器並存取端點 URL。如果是第一次開啟它,系統會提示您輸入 Oracle Sales Automation 使用者認證。
    例如,在 Oracle Sales Automation 版本 12 的 REST API 中,若要存取最新 API 版本的商機服務端點,URL 為:

    https://˂crm_server:PortNumber˃/salesApi/resources/latest/opportunities

  2. (選擇性) 如果您要取得特定資源的其他資訊,可以使用資源的描述 URL 取得其他描述資料,其中包含欄位、可採取的動作、子項物件以及值資源清單。
    例如,在 Oracle Sales Automation 版本 12 的 REST API 中,在機會服務端點中,描述 URL 為:

    https://˂crm_server:PortNumber˃/salesApi/resources/latest/opportunities/describe

    Oracle Sales Automation REST API 包含下列 RESTful Web 服務端點,請注意部分端點 URL 已從 R12 變更為 R13:
    12 版 13 版
     /crmCommonApi/resources/latest/accounts /crmRestApi/resources/latest/accounts
    /salesApi/resources/latest/activities /crmRestApi/resources/latest/activities
    /serviceApi/resources/latest/categories /crmRestApi/resources/latest/assets
    /incentiveCompensationApi/resources/latest/compensationPlans /crmRestApi/resources/latest/businessPlans
    /salesApi/resources/latest/competitors  /crmRestApi/resources/latest/categories
    /crmCommonApi/resources/latest/contacts /crmRestApi/resources/latest/channels
    /incentiveCompensationApi/resources/latest/creditCategories /fscmRestApi/resources/latest/compensationPlans
    /salesApi/resources/latest/deals /crmRestApi/resources/latest/competitors
    /salesApi/resources/latest/territoryForecasts /crmRestApi/resources/latest/contacts
    /crmCommonApi/resources/latest/households /fscmRestApi/resources/latest/creditCategories
    /crmCommonApi/resources/latest/lightboxDocuments /crmRestApi/resources/latest/deals
    /salesApi/resources/latest/opportunities /crmRestApi/resources/latest/territoryForecasts
    /incentiveCompensationApi/resources/latest/incentiveCompensationParticipants /crmRestApi/resources/latest/households
     /salesApi/resources/latest/partnerPrograms /crmRestApi/resources/latest/inboundMsgFilters
    /salesApi/resources/latest/partnerTiers /crmRestApi/resources/latest/inboundMessages
    /salesApi/resources/latest/partners /crmRestApi/resources/latest/interactions
    /incentiveCompensationApi/resources/latest/paymentBatches /crmRestApi/resources/latest/lightboxDocuments
     /incentiveCompensationApi/resources/latest/paymentTransactions  /crmRestApi/resources/latest/presentationSessionFeedback
    /incentiveCompensationApi/resources/latest/paysheets  /crmRestApi/resources/latest/presentationSessions
    /incentiveCompensationApi/resources/latest/incentiveCompensationPerformanceMeasures  /crmRestApi/resources/latest/mySelfServiceRoles
    /incentiveCompensationApi/resources/latest/planComponents /crmRestApi/resources/latest/salesObjectives
    /salesApi/resources/latest/priceBookHeaders /crmRestApi/resources/latest/opportunities
    /salesApi/resources/latest/setupSalesCatalogs /fscmRestApi/resources/latest/incentiveCompensationParticipants
    /salesApi/resources/latest/products /crmRestApi/resources/latest/partnerPrograms
     /salesApi/resources/latest/partnerProgramBenefits /crmRestApi/resources/latest/partnerTiers
     /salesApi/resources/latest/programEnrollments  /crmRestApi/resources/latest/partners
    /serviceApi/resources/latest/queues /fscmRestApi/resources/latest/paymentBatches
     /incentiveCompensationApi/resources/latest/rateDimensions /fscmRestApi/resources/latest/paymentTransactions
    /incentiveCompensationApi/resources/latest/rateTables /fscmRestApi/resources/latest/paysheets
    /crmCommonApi/resources/latest/resources /fscmRestApi/resources/latest/incentiveCompensationPerformanceMeasures
     /incentiveCompensationApi/resources/latest/incentiveCompensationRoles /fscmRestApi/resources/latest/planComponents
    /salesApi/resources/latest/leads /crmRestApi/resources/latest/priceBookHeaders
    /crmCommonApi/resources/latest/salesOrders /crmRestApi/resources/latest/setupSalesCatalogs
    /salesApi/resources/latest/salesPromotions /crmRestApi/resources/latest/products
    /crmPerformanceApi/resources/latest/territories /crmRestApi/resources/latest/partnerProgramBenefits
     /serviceApi/resources/latest/serviceRequests /crmRestApi/resources/latest/programEnrollments
    /salesApi/resources/latest/sourcecodes /crmRestApi/resources/latest/queues
    - /fscmRestApi/resources/latest/rateDimensions
    - /fscmRestApi/resources/latest/rateTables
    - /crmRestApi/resources/latest/resources
    - /fscmRestApi/resources/latest/incentiveCompensationRoles
    - /crmRestApi/resources/latest/leads
    - /crmRestApi/resources/latest/salesOrders
    - /crmRestApi/resources/latest/salesPromotions
    - /crmRestApi/resources/latest/territories
    - /crmRestApi/resources/latest/proposals
    - /crmRestApi/resources/latest/screenPopPages
    - /crmRestApi/resources/latest/screenPopTokens
    - /crmRestApi/resources/latest/selfRegistrations
    - /crmRestApi/resources/latest/selfServiceRoles
    - /crmRestApi/resources/latest/selfServiceUsers
    - /crmRestApi/resources/latest/serviceDetails
    - /crmRestApi/resources/latest/serviceProviders
    - /crmRestApi/resources/latest/serviceRequests
    - /crmRestApi/resources/latest/socialPosts
    - /crmRestApi/resources/latest/sourcecodes
    - /crmRestApi/resources/latest/wrapUps

    附註:

    API 名稱會根據資源物件所屬的 Oracle Sales Automation 應用程式容器而變更。

關於 REST 作業與有效負載結構

每個標準 Oracle Sales Automation 物件的 RESTful Web 服務提供數個建立、讀取、更新及刪除 (CRUD) 作業。

您可以執行下列標準方法,透過單一資源或資源集合的 URL 與其互動:

方法 適用於單一資源 可用於資源集合
取得 Y N
張貼 N Y
修正程式 Y N
刪除 Y N

關於 Get 方法

使用此方法來查詢和擷取資訊。不過,查詢中用來縮小搜尋範圍或縮小單一資源結果範圍的參數,與資源集合中使用的參數不同。

單數與收帳資源的參數

方法中使用下列參數來查詢單一資源以及集合資源:

Parameter - 參數 格式 描述
expand

expand=<childResource1>,<childResource2>...

expand=all

傳回包含其下階的上階資源。預設不會傳回任何子項。
fields fields=<FieldName1>,<FieldName2>... 只選取其資訊為必要的某些欄位。
onlyData

onlyData=true

onlyData=false

僅擷取資料,不擷取任何資源 URL。預設會傳回所有資源子項 URL。

收集資源的參數

收集資源的 GET 方法會使用上述參數以及下列參數:

Parameter - 參數 格式 描述
limit

limit=<Integer>

大於 0 的整數,指定伺服器傳回的項目數上限。如果未指定限制值,伺服器將會使用預設的限制值。
offset offset=<Integer> 整數值,指定第一個要傳回的項目索引。偏移索引從 0 開始。
q

q=<condition1>;<condition2>;…

指定篩選條件以限制集合中傳回的項目。此查詢參數的值包含一或多個以 ";" 區隔的表示式。例如 q=deptno>=10 and <=30;loc!=NY

支援的運算子:

>

<

>=

<=

!=

AND

OR

=

LIKE

特殊字元:

  • 文字的雙引號或單引號,例如:"literal value 1" 或 'literal value2'

  • 反斜線以遁離字元:\

  • 萬用字元的星號:*

totalResults

totalResults=true

totalResults=false

指定是否傳回符合 "q" 查詢參數之項目總數的布林值。
orderBy

orderBy=<field1:asc>,<field2:desc>.

指定回應有效負載中傳回項目的順序。查詢參數值是欄位名稱的逗號分隔字串,每個字串會選擇性地後面跟著冒號和關鍵字 ascdesc

若未指定,伺服器會依遞增順序傳回項目。

finder

finder=FinderName;<attr1>=<val1>,<attr2>=<value2>

使用具有專屬特殊參數的預先定義「查詢」。

例如,Opportunities 資源具有名為 MyOpportunitiesFinderfinder 函數,此函數具有可設為 AutoName 參數。此通話會擷取目前使用者擁有且名稱開頭為「自動」的所有機會。

dependency

dependency=<attr1>=<val1>

用於串聯值清單資源。例如,如果 Location 資源有 State 欄位,這些值將衍生自另一個傳回特定「國家 / 地區 (位置)」之「州 / 省」清單的 States 資源。例如,位置為:美國,州為 CA。「州」資源包含所有「美國」的清單,但如果網頁中的使用者將地區設定變更為「巴西」,則擷取所有巴西州的方式會有如下的呼叫:

States?dependency=Country=BR

關於 Post 方法

使用此方法來建立新項目。要求媒體類型標頭為:

application/vnd.oracle.adf.resourceitem+json

例如,若要在 Opportunities 資源下建立新機會,要求會在 JSON 物件中傳送新的機會名稱參數:

{
"Name" : "New Opportunity Name"
}

POST 要求傳回之 JSON 物件的回應主體如下:


{
BudgetAvailableDate: null
BudgetedFlag: false
PrimaryOrganizationId: 204
ChampionFlag: false
CreatedBy: "SALES_ADMIN"
CreationDate: "2015-06-04T03:08:27-07:00"
CurrencyCode: "USD"
SalesMethodId: 100000012430001
SalesStageId: 100000012430007
Name: "New Opportunity Name"
OptyId: 300100111705686
OptyNumber: "CDRM_332708"
OwnerResourcePartyId: 3807
StatusCode: "OPEN"
PrimaryRevenueId: 300100111705687
SalesMethod: "Standard Sales Process"
SalesStage: "01 - Qualification"
DescriptionText: "Looking for the Right Contacts, Characteristics,
Determining the Need, Budget and Sponsor"
AverageDaysAtStage: 30
MaximumDaysInStage: 800
PhaseCd: "QUALIFICATION-DISCOVERY"
QuotaFactor: 3
RcmndWinProb: 0
StageStatusCd: "OPEN"
StgOrder: 1
EffectiveDate: "2015-06-24"
Revenue: 0
WinProb: 0
PartyName1: "Charles Taylor"
DownsideAmount: 0
UpsideAmount: 0
EmailAddress: "firstname lastname@orcl.com"
ExpectAmount: 0
ForecastOverrideCode: "CRITERIA"
SalesChannelCd: "ZPM_DIRECT_CHANNEL_TYPES"
…
}

關於修正方法

使用此方法對資源進行部分更新。只會更新要求主體中包含的欄位。

要求媒體類型為:

application/vnd.oracle.adf.resourceitem+json

例如,若要從 Oppurtunities 資源更新現有的機會,HTTP PATCH 要求會傳送下列 JSON 物件作為要求主體:

{
"Name": "Opportunity Name Updated"
}

此要求的回應是類似以下的 JSON 物件:


{
BudgetAvailableDate: null
BudgetedFlag: false
PrimaryOrganizationId: 204
ChampionFlag: false
CreatedBy: "SALES_ADMIN"
CreationDate: "2015-06-04T03:08:27-07:00"
CurrencyCode: "USD"
SalesMethodId: 100000012430001
SalesStageId: 100000012430007
Name: "Opportunity Name Updated"
OptyId: 300100111705686
OptyNumber: "CDRM_332708"
OwnerResourcePartyId: 3807
StatusCode: "OPEN"
PrimaryRevenueId: 300100111705687,
SalesMethod: "Standard Sales Process"
SalesStage: "01 - Qualification"
DescriptionText: "Looking for the Right Contacts, Characteristics,
Determining the Need, Budget and Sponsor"
AverageDaysAtStage: 30
MaximumDaysInStage: 800
PhaseCd: "QUALIFICATION-DISCOVERY"
QuotaFactor: 3
RcmndWinProb: 0
StageStatusCd: "OPEN"
StgOrder: 1
EffectiveDate: "2015-06-24"
Revenue: 0
WinProb: 0
PartyName1: "Charles Taylor"
DownsideAmount: 0
UpsideAmount: 0
EmailAddress: "firstname_lastname@orcl.com"
ExpectAmount: 0
ForecastOverrideCode: "CRITERIA"
SalesChannelCd: "ZPM_DIRECT_CHANNEL_TYPES"
…
}

關於刪除方法

使用此方法刪除資源。它不需要要求主體。

例如,若要從 Opportunities 資源刪除 Opportunity 物件,必須直接向要刪除之子項 Opportunity 資源的 URI 發出 DELETE 要求,且不傳送任何參數:

https://<crm_server:PortNumber>/salesApi/resources/latest/opportunities/<OpportunityNumber>

關於自訂動作方法

有時候,資源會公開不符合 CRUD 標準的自訂動作。自訂動作一律使用 POST (單一和資源集合) 呼叫,其要求媒體類型為:

application/vnd.oracle.adf.action+json

回應媒體類型為:

application/vnd.oracle.adf.actionresult+json

例如,在 Oracle Sales Automation 中,https://<crm_server:portNumber>/salesApi/resources/latest/describe/leads/ 下的 leads 資源具有自訂動作,可將潛在客戶轉換為名為 convertLeadToOpty 的機會。

{
          "name" : "convertLeadToOpty",
          "parameters" : [ {
            "name" : "leadId",
            "type" : "number",
            "mandatory" : false
          } ],
          "resultType" : "string",
          "method" : "POST",
          "requestType" : [ "application/vnd.oracle.adf.action+json" ],
          "responseType" : [ "application/json", "application/vnd.oracle.adf.actionresult+json" ]
        },

將自訂動作視為一系列步驟、程序或不同 CRUD 作業的組合,以達成特定目標。在上述範例中,「自訂動作」的要求主體必須傳送將成為該自訂動作名稱 (例如 convertLeadToOpty) 的 name ,以及自訂動作 (例如 leadId) 的選擇性輸入參數陣列。

POST 要求的 JSON 主體通常包含:

{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "Action execution representation.",
"description": "Represents the action execution and its
parameters.",
"properties": {
"name": {
"type": "string",
"description": "Action name."
},
"parameters": {
"type": "array",
"description": "Parameter name/value pair.",
}
},
"required": [
"name"
]
}

JSON 回應物件會保留「結果」欄位中自訂動作方法的結果。

關於批次支援

為了提升效能,您可以將包含 "parts" 欄位的 JSON 物件作為物件陣列,將多個作業結合成單一 HTTP 要求。陣列中的每個物件都包含唯一的 ID、資源的相對路徑、作業,以及選擇性的有效負載 (Payload)。

HTTP 要求的 JSON 綱要為:


{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "Batch execution",
"description": "Group multiple requests together ('part').",
"definitions": {
"Part": {
"type": "object",
"allOf": [
{
"properties": {
"id": {
"type": "string",
"description": "An identification
provided by the client to distinguish each part provided in the
batch request."
},
"path": {
"type": "string",
"description": "Resource's location."
},
"operation": {
"type": "string",
"enum": [
"get",
"create",
"update",
"replace",
"delete"
],
"description": "The operation that will
be performed."
},
"preconditionSucceeded": {
"type": "boolean",
"description": "This attribute is set in
the batch response only when ifMatch or ifNoneMatch are provided in
the request. It will be 'true' if the precondition
(ifMatch/ifNoneMatch) was satisfied, otherwise 'false'."
},
"payload": {
"oneOf": [
{
"$ref": "resource-item.json",
"description": "The payload that
will be used in the operation. Example: a resource instance should
be provided in order to execute a 'create'."
},
{
"type": "null"
}
]
}
},
"required": [
"id",
"path",
"operation"
]
}
],
"anyOf": [
{
"properties": {
"ifMatch": {
"type": "string",
"description": "This attribute is
analogous to the If-Match header. It represents a precondition to
execute this operation. The value can be null (same effect of 'If-
Match: *') or an array of resource versions."
}
}
},
{
"properties": {
"ifNoneMatch": {
"type": "string",
"description": "This attribute is
analogous to the If-None-Match header. It represents a precondition
to execute this operation. The value can be null (same effect of
'If-None-Match: *') or an array of resource versions."
}
}
}
],
"description": "Represents a request."
}
},
"properties": {
"parts": {
"type": "array",
"items": {
"$ref": "#/definitions/Part"
},
"description": "Array that represents multiple
requests."
}
},
"required": [
"parts"
]
}

例如,下列要求會擷取現有員工並更新其他員工:


POST /myapi/resources/latest/hremployees HTTP/1.1
Host: example.oracle.com
Content-type:application/vnd.oracle.adf.batch+json
{
"parts": [
{
"id": "part1",
"path": "/latest/hremployees/101",
"operation": "get"
},
{
"id": "part2",
"path": "/latest/hremployees/102",
"operation": "update",
"payload": {
"Salary": 18000
}
}
]
}

上一個要求的回應使用與要求相同的媒體類型,並傳回 JSON 物件,例如:

{"parts":[
{
"id":"part1",
"path":"/latest/hremployees/101",
"operation":"get",
"payload" : {
"EmployeeId" : 101
…
},
{
"id" : "part2",
"path" : "/latest/hremployees/102",
"operation" : "update",
"payload" : {
"EmployeeId" : 102,
} ]}

測試 Oracle Sales Automation RESTful Web 服務要求

若要測試 RESTful API 並取得必要資料,您可以使用 cURL 命令列工具,使用其中一個支援的協定 (例如 HTTP 或 HTTPS) 將資料從伺服器傳輸或傳輸到伺服器。

在此範例中,我們將使用 cURL 工具來存取 RESTful API:
  1. 確定您具有有效的 REST URL (端點),例如在 Oracle Sales Automation 12 版中,accounts 資源的端點為:

    https://<crm_server:PortNumber>/crmCommonApi/resources/latest/accounts

  2. 備妥您的安全性憑證。
  3. 確定您已安裝 cURL 工具,否則:
    1. 在您的瀏覽器中,瀏覽至位於 http://curl.haxx.se/download.html 的 cURL 首頁,然後按一下左側導覽功能表中的下載
    2. 在「cURL 版本與下載」頁面上,找出與作業系統對應的啟用 SSL 版本 cURL 軟體,按一下連結以下載 ZIP 檔案,然後安裝軟體。
    3. 瀏覽至位於 http://curl.haxx.se/docs/caextract.html 的「cURL CA 憑證」頁面,然後在您安裝 cURL 的資料夾中下載 ca-bundle.crt SSL CA 憑證組合。
    4. 開啟命令視窗,導覽至您安裝 cURL 的目錄,並將 cURL 環境變數 CURL_CA_BUNDLE 設為 SSL 憑證授權機構 *CA 憑證組合的位置。例如:
      C:\curl> set CURL_CA_BUNDLE=ca-bundle.crt

      您現在可以開始使用 cURL。

  4. 使用 cURL 工具對資源發出 HTTP 要求:
    $ curl –k –u <userName> https://<crm_server:PortNumber>/crmCommonApi/resources/latest/accounts
  5. 您可以預期回應類似以下所示的內容:
    {
    "items" : [ {
    "PartyId" : 300100010648746,
    "PartyNumber" : "CDRM_2260",
    "SourceSystem" : null,
    "SourceSystemReferenceValue" : null,
    "OrganizationName" : "DLAKWRVBBU",
    "UniqueNameSuffix" : "US)",
    "PartyUniqueName" : "DLAKWRVBBU US)",
    "Type" : "ZCA_CUSTOMER",
    "OwnerPartyId" : 100010025532672,
    "OwnerPartyNumber" : "100010025532672",
    "OwnerEmailAddress" : "sendmail-test-discard@oracle.com",
    ...
    },
    {
    ...
    } ],
    "count" : 25,
    "hasMore" : true,
    "limit" : 25,
    "offset" : 0,
    "links" : [ {
    "rel" : "self",
    "href" :
    "https://host:port/crmCommonApi/resources/latest/accounts",
    "name" : "accounts",
    "kind" : "collection"
    } ]
    }
  6. 在回應主體中,您可以查看每個資源的連結,其中包含可對其執行的動作。
  7. (選擇性) 您可以使用 /describe URI 取得資源的中繼資料,例如:
    $ curl –k –u <userName> https://<crm_server:PortNumber>/crmCommonApi/resources/latest/accounts/describe

    它會傳回類似的東西:

    
    {
    "Resources" : {
    "accounts" : {
    "discrColumnType" : false,
    "title" : "Sales Cloud Account SDO",
    "attributes" : [ {
    "name" : "PartyId",
    "type" : "integer",
    "updatable" : false,
    "mandatory" : true,
    "queryable" : true,
    "precision" : 18,
    "properties" : {
    "fnd:GLOBALLY_UNIQUE" : "true"
    }
    }, {
    "name" : "PartyNumber",
    "type" : "string",
    "updatable" : true,
    "mandatory" : true,
    "queryable" : true,
    "precision" : 30,
    "maxLength" : "30",
    "properties" : {
    "DISPLAYWIDTH" : "40"
    }
    }, {
    "name" : "SourceSystem",
    "type" : "string",
    "updatable" : true,
    "mandatory" : false,
    "queryable" : true
    }, {
    ...],
    "links" : [ {
    "rel" : "self",
    "href" :
    "https://host:port/crmCommonApi/latest/latest/accounts",
    "name" : "self",
    "kind" : "collection"
    } ],
    "actions" : [ {
    "name" : "get",
    "method" : "GET",
    "responseType" : [ "application/json",
    "application/vnd.oracle.adf.resourcecollection+json" ]
    }, {
    "name" : "create",
    "method" : "POST",
    "requestType" : [
    "application/vnd.oracle.adf.resourceitem+json" ],
    "responseType" : [ "application/json",
    "application/vnd.oracle.adf.resourceitem+json" ]
    } ]
    }
    ...

    您可以從中繼資料觀察到您可以在 /accounts 資源上發出 POST 指令來建立資源。