Mostly used with select parameter or a search button.
Syntax of RPC output
In order to correctly show a response from your remote procedure, the output section of response must contain label and value.
The label is what a user sees when selecting items from the select dropdown, and value is what will be sent to the endpoint once the module is executed.
The limit is required if the API endpoint returns a large number of items (> 500).
Read more about it here.
The default is optional and when true, the first item from the RPC response is pre-selected.
Notice the iterate directive which involves the container and the condition objects. The container defines, what should be iterated. While the condition defines the criteria each item must satisfy to be included in the list.
Select parameter with nested RPCs
If your parameters are dependent on each other. The most common example would be dynamically selecting a file. To do it user would select an Account -> Folder -> File. Meaning RPC would require a value of the previous RPC.
Luckily, it is possible to nest RPCs under each other on Make. Here is an abstract example of how it would look inside a module's mappable parameters and RPC's communication.
Don't forget to put all your options to store property inside options. Without it nested will not work.
[ {"name":"parameter_1","type":"select","label":"Parameter 1","required":true,"mappable":false,"options": {"store":"rpc://exampleRpc1",//proper usage of options in this case"nested": [ {"name":"parameter_2","type":"select","label":"Parameter 2","required":true,"mappable":false,"options": {"store":"rpc://exampleRpc2",//don't forget to store your options"nested": ["name": "parameter_3","type": "select","label": "Parameter 3","required": true,"mappable": false,"options": "rpc://exampleRpc3"//you are not using "nested" after it //-> there's no need to "store" options ] } } ] } }]
Notice, that {{parameters.parameter_2}} is inherited from the 2nd RPC and passed as query to the 3rd RPC call.
But you're not restricted to using inherited parameters in qs only. In the example below, the nested RPCs obtain a value from the parent's RPC and it is passed to the nested RPC in URL.
Sometimes, it is worth implementing an advanced search (if API does have such endpoints available), which allows a user to enter as many conditions as possible, in order to find the particular record to work with.
{"name": "ticket","label": "Ticket ID","type": "text","required": true,"rpc": {"url":"rpc://listTickets","label":"Search Tickets","parameters": [ {"name":"filter","type":"select","label":"Predefined Filter","options": [ {"label":"New and my open","value":"new_and_my_open" }, {"label":"Watching","value":"watching" }, {"label":"Spam","value":"spam" }, {"label":"Deleted","value":"deleted" } ] }, {"name":"requester_id","type":"text","label":"Requester(Agent) ID","rpc": {"label":"Search Agents","url":"rpc://listAgents","parameters": [ {"name":"term","label":"Term","type":"text","required":true,"help":"◉ The search is case insensitive.\n◉ You cannot search with a substring. For example, an agent \"John Jonz\" can be looked up using \"john\", \"Joh\", \"Jonz\" and \"jon\". But it will not be returned when you search for \"hn\" or \"th\"." } ] } }, {"name":"company_id","type":"text","label":"Company ID","rpc": {"label":"Search Companies","parameters": [ {"name":"term","label":"Keyword Name","type":"text","help":"◉ It is case insensitive.\n◉ You cannot search with a substring. For example, a company \"Acme Corporation\" can be looked up using \"acme\", \"Ac\", \"Corporation\" and \"Co\". But it will not be returned when you search for \"cme\" or \"orporation\"." } ],"url":"rpc://listCompanies" } }, {"name":"updated_since","type":"date","label":"Updated Since" } ] } },... ]
Sometimes, it is better to keep the list of available options outside of mappable parameters code. To keep the code readability or use the same piece of code multiple times (like a reusable component).
In this case, we can create a "fake" RPC, where we manually define the list of available options which will be returned in the RPC's output.
Sometimes, you can use one general RPC instead of multiple similar RPC with different qs parameters.
Example: You have one general search endpoint, which requires to specify the type of the search companies or contacts.
Instead of creating separate RPCs or hidden parameters inside each module, where the RPC is used. You can send all needed parameters as a query to the RPC.