LoginSignup
1
0

SalesforceのAPIを使う時に間違えやすいポイント

Posted at

何故かBulk API Ver 1ではヴァージョンの部分は数字だけですが、その他の大半のAPIではvが付きます。
ついつい間違えてしまうポイントです。

この場合は404エラーになるのでエンドポイントが違います。その時はvがあるかをチェックします。
以下も同じでした。

Request URL: [https://REDACTEDDOMAIN.my.salesforce.com/services/data/56.0/sobjects/ApexTrigger]

Request body: [{"Name":"UploadTest_AccountTrigger","TableEnumOrId":"Account","Body":"trigger Account_AccountWebhook on Account (after insert, after update) {}"}]

Status Code: [404]

Body: [[{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}]]

So after the depressing finding that the "v" prefix for the version is missing the Tooling API approaches base URL it works now as described.

Below you can find the correct way to build the request URL (replace this in the Tooling API Approach:

String url = session.getBaseUrl() + "/services/data/v" + session.getApiVersion() + "/sobjects
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0