Salesforce Metadata Refresh Using API


When there are changes in metadata, users must refresh it before executing the test plan to avoid failures. Users can now swiftly refresh metadata using API calls without logging into the Testsigma application or performing UI actions. This article discusses refreshing metadata using API calls.


Prerequisites

Before you begin, ensure that you have referred to:

  1. Documentation on creating Salesforce Connected App.
  2. Documentaion on creating Salesforce Metadata connected to Testsigma.
  3. Documentation on refreshing Metadata.

Steps to Get Metadata Connection ID

  1. From the Dashboard, click SF Connections. SF Connections
  2. In the Metadata Connection section, hover over the connection, click the kebab menu, and choose Copy Connection ID from the dropdown menu. Metadata Connection

Trigger Refresh Metadata Using API

Request Type POST
Endpoint https://app.testsigma.com/api_private/v1/salesforce_metadata_sync/sync_data
Authorization Bearer <API_Token>

(Same as the Testsigma API Key)
Request Body Type JSON
Request Body (Sample)
{
"id": 70
}
Response Body (Sample)
{
"id": 133,
"metadataSyncResult": "NOT STARTED",
"metadataSyncType": "UPDATE SYNC",
"salesforceConnectionId": 70
}

Metadata Refresh


Request fields / Response fields

  • id: Refresh Trigger ID.
  • metadataSyncResult: Status of metadata sync process.
  • metadataSyncType: Type of metadata sync.
  • salesforceConnectionId: Salesforce Connection ID.

Get Metadata Refresh Status Using API

Request Type GET
Endpoint https://app.testsigma.com/api_private/v1/salesforce_metadata_sync/<Trigger_ID>/fetchMetaDataSyncResultStatus
Authorization Bearer <API_Token>

(Same as the Testsigma API Key)
Response Body Type JSON
Response Body (Sample)
{
"status": "IN_PROGRESS",
"message": "Metadata refresh already in progress"
}

API Step


Request fields / Response fields

  • status: Status of metadata sync process.
  • message: Additional information of sync process.