Forum Discussion

DanaHauser's avatar
DanaHauser
Qrew Cadet
3 years ago

Get JSON from previous step in Pipeline for 2nd API call to external source

Hi, I'm looking for some help with a pipeline.  I've created step A which sends an api call for a MLS property search.  This first step I used the Make a Request function under webhooks.  It gets an access token and runs a property search, which comes back with the following results at the end of this post. 

The only data I need from the results is the corelogicPropertyId, which I need for step B in order to get the property data back using this ID.  The URL I need to make the B call is https://property.corelogicapi.com/v2/properties/<clip>/ownership

<clip> is where I need to insert the corelogicProperyId into the URL for step B.  How do I pull this # to step B?  I'm kind of stuck at this point, any help would be very appreciated. 

Thanks!

Step A results:

{
"pageNumber": 1,
"pageSize": 1,
"totalRecords": 1,
"totalPages": 1,
"data": [
{
"corelogicPropertyId": "48243:74130542",
"compositePropertyId": "48243:74130542",
"fipsCode": "48243",
"apn": "H150-000-00P00070",
"latitude": 30.6703,
"longitude": -103.9664,
"universalParcelId": "74130542",
"parcelNumber": "H15000000P00070",
"parcelSequence": "1",
"houseNumber": null,
"houseNumber2": null,
"preDirection": "W",
"streetName": "WALNUT AVENUE OR 408",
"streetSuffix": null,
"postDirection": null,
"unitNumber": null,
"houseNumberSuffix": null,
"city": "FORT DAVIS",
"county": "JEFF DAVIS",
"zipcode": "79734",
"zip4": null,
"state": "TX",
"carrierRoute": null,
"streetAddress": "W WALNUT AVENUE OR 408",
"links": [
{
"rel": "self",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "ownership",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/ownership",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "building",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/building",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "foreclosure",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/foreclosure",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "tax-assessment",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/tax-assessment",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "VP4",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/avm/rave/VP4",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "PASS",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/avm/rave/PASS",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "GeoAVMCore",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/avm/rave/GeoAVMCore",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "GeoAVMPrecision",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/avm/rave/GeoAVMPrecision",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "Prospector",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/avm/rave/Prospector",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "sales-history",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/sales-history",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "finance-history",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/finance-history",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "site",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/site",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "summary",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/summary",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "location",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/location",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "comparables",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/comparables",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "owner-transfer",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/owner-transfer",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "last-market-sale",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/last-market-sale",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "prior-sale",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/prior-sale",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "current-transfer",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/current-transfer",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "current-first-mortgage",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/current-first-mortgage",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
},
{
"rel": "legal-and-vesting",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property/48243:74130542/legal-and-vesting",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
}
]
}
],
"links": [
{
"rel": "self",
"href": "https://clp-api-property-gcpprd-ext-prd.apps.pci.pcfusw1prd.solutions.corelogic.com/property?address=%091600%20Walnut%20Avenue%20&zip5=78702&responseLimit=100&pageNumber=1&pageSize=10",
"hreflang": null,
"media": null,
"title": null,
"type": "application/vnd.corelogic.v1+json",
"deprecation": null
}
]
}


------------------------------
Dana Hauser
------------------------------

11 Replies

  • Dana
    are you using the step called Fetch JSON?  Do not an API call but Fetch JSON

    And then you paste in the API response into the sample code area and it should create a panel of fields for you to drag into a subsequent step.

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------
    • DanaHauser's avatar
      DanaHauser
      Qrew Cadet
      Hi Mark,

      I didn't use the Fetch JSON, because I needed to do a OATH 2.0 for the calls after the authentication call to get the temporary auth key.  I was able to do the auth for the key and the 2nd call to get the property ID in the same webhook call.  The Fetch JSON doesn't have the option to use OATH 2.0 so I wasn't sure.

      Thanks,

      Dana

      ------------------------------
      Dana Hauser
      ------------------------------
  • @Dana Hauser

    First, you'll need to convert the content returned from your API into something you can work with in jinja2.

    When you use the Make a Request step from the Webhooks channel, one of the variables returned should be "Content".

    You can convert that content into something usable by creating a new variable, and then applying the from_json filter.

    {% set json_content=a.content | from_json %}
    after you have converted the content from json, you can access the properties in the same way you would any other variable using jinja2 in Pipelines. For your purposes it would probably look like this:

    {% set json_content=a.content | from_json %}
    {{json_content.data[0].corelogicPropertyId}}

    If you don't have to use OAuth authentication to access the API, I would recommend using the JSON Handler channel instead. It will make it a lot easier to work with the data, especially if need work with a response containing more than one record.



    ------------------------------
    Justin Torrence
    Quickbase Expert, Jaybird Technologies
    jtorrence@jaybirdtechnologies.com
    https://www.jaybirdtechnologies.com/#community-post
    ------------------------------
    • DanaHauser's avatar
      DanaHauser
      Qrew Cadet
      Hi Justin,

      Thanks for your reply.  I'll try your suggestion and see what happens.  I didn't use the Fetch JSON due to the OATH 2.0 I needed right off the bat.  I explained it a little more in my reply to Mark below. 

      Thanks,

      Dana

      ------------------------------
      Dana Hauser
      ------------------------------
      • DanaHauser's avatar
        DanaHauser
        Qrew Cadet
        Justin,

        This makes total sense, but I'm not exactly sure where to put the jinja2 code?
        {% set json_content=a.content | from_json %}
        {{json_content.data[0].corelogicPropertyId}}

        Thanks again,

        Dana

        ------------------------------
        Dana Hauser
        ------------------------------