Skip to content

05 Sql Server Stored procedure as endpoint

Resources

  1. Auto generator for stored procedure parameters template-for-sql-parameters can be used to generate parameters for stored procedure endpoint.

Example 1 - auto parameters mode

All parameters that will match stored procedure parameters name will be sent

XML
1
2
3
4
5
6
7
8
<srs title="Execute sql ">
  <def> 
    <itm model="param" name="task_modified_by" type="server">[[kv.v.user.username]]</itm>
    <itm name="api">
        [dbo].[task_set]
    </itm>
  </def>
</srs>

Example 2 - with defined parameters

If any parameter in parameters node then

  • only parameters defined in parameters node are sent
  • you can pass server side values see srs/parameters <itm model="param" name="task_modified_by" type="server">[[kv.v.user.username]]</itm>

XML
<srs title="API task POST">
  <def>
    <itm model="param" name="team_id"></itm>
    <itm model="param" name="type_id"></itm>
    <itm model="param" name="task_name"></itm>
    <itm model="param" name="task_description"></itm>
    <itm model="param" name="task_internal_notes"></itm>
    <itm model="param" name="task_reporter"></itm>
    <itm model="param" name="task_resolved_at"></itm>
    <itm model="param" name="task_tags"></itm>
    <itm model="param" name="task_modified_by" type="server">[[kv.v.user.username]]</itm>
     <itm name="api">
        [dbo].[task_set] </itm>
    </itm>
  </def>
</srs>
XML
1
2
3
4
5
6
7
8
<srs title="Dictionary">
  <def>
    <itm model="param" name="username" opts="server">[[kv.v.user.username]]</itm>


    <itm model="command" name="warehouse">[erp].[dictionary_bynameValue] @username =@username, @dictionary='warehouse'</itm>
  </def>
</srs>