Best answer

Dynamid Field - Help with the code

  • 4 February 2021
  • 3 replies
  • 48 views

Userlevel 1

Hello,

We would like to add a “Dynamic Field” so when a user is using an Action, Zapier will call our API and get the list of fields and display them to the user.

The first part is to call our API to get the documentation for specific instance ${bundle.inputData.eid}

The ${bundle.inputData.eid} is a field the user needs to select when they add the Action.

const options = {
  url: `https://api.spotme.com/api/v2/workspace/${bundle.inputData.eid}/documentation/`,
  method: 'GET',
  headers: {
    'Accept': 'application/json'
  },
  params: {

  }
}

 

The next part is to parse the result (specifically the results under definitions → person → properties) and I’m having trouble with parsing it to the way Zapier is asking for. Can anyone help please?

 

Result for example:

{“swagger”: “2.0”,

“info” : {}

“definitions” : {

“person” : {

“properties” :{

“_id” : {“description” : “ID of the user”, “type” : “string”},

“fname” : {“description” : “First Name”, “type” : “string”}

}}}}

 

Goal is to parse the fields so they can be displayed to the user.:

_id ==> String

fname ==> string

 

icon

Best answer by GetUWired 4 February 2021, 17:39

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 7
Badge +12

From your information it looks like you could get there with

id = result.definitions.person.properties[“_id”].description

and the same but fname instead of _id

Userlevel 4
Badge +6

Hey @SpotMe!

Just checking in. Was the information from GetUWired able to help resolve your issue? Let us know! :)

Userlevel 1

That’s perfect, thank you @GetUWired @Jillian !