本文介绍了如何判断实例特定的 Salesforce URL 是来自 Sandbox 还是 Production?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我只有 URL 和会话 ID,如何判断实例特定的 Salesforce URL 是来自 Sandbox 还是 Production?

How to tell if instance specific Salesforce URL is from Sandbox or Production, if I have the URL and Session Id only?

推荐答案

如果你知道实例 &sessionId,然后您可以在 {instance}/services/data/v25.0 处调用 REST api 的发现服务,并在授权标头中传递 sessionId,例如使用 curl 这将是

If you know the instance & sessionId, then you can call the REST api's discovery service at {instance}/services/data/v25.0 passing the sessionId in a Authorization header, e.g. using curl this would be

curl -v -H "Authorization: OAuth {sessionId}" https://{instance}/services/data/v25.0/

这会返回发现数据,包括用户身份 ID,例如

This returns you the discovery data, including the users Identity Id, e.g.

"id": "https://login.salesforce.com/id/00D300000000QSfEAM/00530000000dImzAAE"

如果主机是 login.salesforce.com 它的产品,如果它的 test.salesforce.com 它是沙箱.

If the host is login.salesforce.com its production, if its test.salesforce.com its sandbox.

这篇关于如何判断实例特定的 Salesforce URL 是来自 Sandbox 还是 Production?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 21:13