Skip to main content
Best answer

Dynamid Field - Help with the code


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

 

Best answer by GetUWired

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

View original
Did this topic help you find an answer to your question?
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

GetUWired
Forum|alt.badge.img+12
  • Zapier Expert
  • 1030 replies
  • Answer
  • February 4, 2021

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


Jillian
Forum|alt.badge.img+6
  • Zapier Staff
  • 123 replies
  • May 5, 2021

Hey @SpotMe!

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


  • Author
  • Beginner
  • 1 reply
  • May 6, 2021

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