Tutorial: Retrieve data using a web request job

This tutorial provides step-by-step instructions to configure and execute a Web Request - GET job to retrieve object data from Salesforce.

For details on the REST API endpoints used in this tutorial, please refer to the following documentation pages:

Prerequisites

Before continuing with this tutorial, ensure you have completed the following prerequisites:

Create a web request GET job

  1. Open the LEARN_DEV project in Snoweaver with the LEARN_DEV_DEVELOPER role.

  2. Open the Jobs page.

  3. Apply the following configuration:

    Name:                   sfdc_get_object_data
    Job Type:               Web Request
    Instance Type:          Procedure
    Request Type:           GET
    Response Format:        Json
    External Integration:   sfdc_learn_dev_access_integration
    Enable Headers:         checked
    Secrets:
        Alias:  token
        Secret: sfdc_learn_dev_oauth_access_token
    ../_images/210.png
  4. Specify the following job vairables:

    Name

    Type

    Test Value

    object

    Text

    Account

    id

    Text

    ../_images/39.png
  5. Use the following Jinja template for specifying the job endpoint URL:

    https://{{_proj.sfdc_account}}.my.salesforce.com/services/data/v61.0/sobjects/{{_vars.object}}/{{_vars.id}}
    
  6. Test the template to validate the output.

  7. Use the following Jinja template for specifying the job headers:

    {
        "Authorization":"Bearer {{_secrets.token}}"
    }
    
  8. Test the template to validate the output.

Test and save the job

  1. Click Preview Request to examine the web request generated by the job.

    ../_images/59.png
  2. Click Make a Test Call to initiate a web request to the specified endpoint URL.

  3. This job retrieves the Account metadata from Salesforce and presents it in JSON format, as previously specified.

    ../_images/65.png
  4. Save the job.

Execute the job

  1. Click Build to build a job instance.

  2. Open a Snowflake worksheet and execute the following SQL statements to call the job instance:

    USE ROLE LEARN_DEV_DEVELOPER;
    CALL SNOWEAVER.LEARN_DEV.SFDC_GET_OBJECT_DATA('ACCOUNT','');
    
  3. This procedure returns the Account metadata encapsulated within a variant value.

    ../_images/88.png
  4. Returning to the Jobs page in Snoweaver.

  5. Locate the Instance Type setting and select Function from the available options.

  6. Save the job.

  7. Run the Build process again.

  8. Open your web browser and go to Salesforce.

  9. In the Sales Console, type “sForce” into the the global search bar at the top of the screen.

    ../_images/10a.png ../_images/10b1.png
  10. Open the sForce Account.

  11. In the address bar, find the record ID and copy it.

    ../_images/1110.png
  12. Return to the Snowflake worksheet and execute the following statements.

    SELECT SNOWEAVER.LEARN_DEV.SFDC_GET_OBJECT_DATA('ACCOUNT','<sForce Id>');
    
  13. The SQL statement executes the job and retrieves specific details for the indicated account.

    ../_images/125.png