Best answer

What does the 'get' property on the Resource Schema intended to do?


I’ve been working with the Platform CLI, however I’m unable to understand what the ‘get’ property on a ‘resource’ is used for and why I need to define it.  Initially thought it would be used similar to a search, but it doesn’t seem to 

I’ve been referencing the ‘get’ property within resource schema: https://github.com/zapier/zapier-platform/blob/zapier-platform-schema@12.0.3/packages/schema/docs/build/schema.md#resourceschema

This question is similar to a closed issue: 

 

icon

Best answer by shalgrim 18 August 2022, 00:29

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.

2 replies

Userlevel 6
Badge +8

Hey @nateiler !

Great question. First, I want to make sure you realize it’s optional, and you don’t need to define it.

As you can see from that documentation, it’s code that goes and gets a single example of that resource from the API. Most APIs, of course, provide this functionality to retrieve one specific item, usually by that item’s ID.

It’s useful in terms of Zapier’s platform in two places:

  1. When a search only returns a small set of data from the objects returned, it would go get the full object
  2. Similarly, after creating an object it would get used to return the full object if, for example, the POST did not return the entirety of the object

Since many APIs aren't 100% consistent in the data/fields that are returned by those two possibilities, we always perform a "get" afterwards, so that we then guarantee the same/consistent data is returned.Thus:

  • search-success -> get
  • create-success ->  get

Hope that clears that up. Let us know if you have any more questions!

Thanks @shalgrim!

Understanding the GET calls are happening in the background after those operations occur is exactly what I was wanting to understand.