# Extending Batch Connect app with custom endpoints

**URL:** <https://discourse.openondemand.org/t/extending-batch-connect-app-with-custom-endpoints/3805>\
**Category:** Get Help\
**Created:** [October 9, 2024, 6:58pm UTC](https://discourse.openondemand.org/t/extending-batch-connect-app-with-custom-endpoints/3805 "2024-10-09T18:58:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pakalee](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/pakalee/32/1155_2.png) [@pakalee](https://discourse.openondemand.org/u/pakalee)\
**Post date:** [October 9, 2024, 6:58pm UTC](https://discourse.openondemand.org/t/extending-batch-connect-app-with-custom-endpoints/3805/1 "2024-10-09T18:58:47Z")

</div>

I’ve had good success with using ood initializer classes to provide backend data for ERB templates. But, now I’d like to make calls using JS and form.js to validate form data as it’s entered (for example, checking if specified files exist, etc).

What’s the best way to do this? I envision creating custom endpoints/routes, but don’t know if I should do that within the BC app or should elsewhere in the ood/RoR stack.

Thanks,  
Lopaka

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [October 9, 2024, 7:35pm UTC](https://discourse.openondemand.org/t/extending-batch-connect-app-with-custom-endpoints/3805/2 "2024-10-09T19:35:50Z")

</div>

3.1 shipped with the `path_selector` widget. It’s a widget that will let the users traverse the file system to choose a `text_field`. No verification needed because the user didn’t type the path, it was determined by where they were/actual files and directories.

That said - while technically you can use any APIs we have in our stack, they’re subject to change without notification. That is, we use them internally and sometimes folks use them too, but we (the developers) give no guarantees on the stability these APIs. It’s just too burdensome for us to maintain all that we do and also APIs to boot. So if you do find and use them, I would say at your own peril I suppose.

You could additionally hack the distribution, but that’s more maintenance you need to take on when you update to successfully apply your patches. Who knows how your additions will fit into our additions when you go to upgrade. You can safely assume that you’ll have a headache to upgrade when routes or something diverges in a weird way.

> [@pakalee](#):
>
> but don’t know if I should do that within the BC app

I think this is your best bet because it’s likely to work forever without maintenance. You can do this within the `submit.yml.erb` and catch anything right before the job submits.

So you’d have something like this in your `submit.yml.erb` to check the file and notify the user before the job ever gets submitted.

```ruby
raise(StandardError, "the file you've chosen: #{the_file_choice} doesn't exist!") unless File.exist?(the_file_choice)

```

---

<div class="post-metadata">

**Author:** ![pakalee](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/pakalee/32/1155_2.png) [@pakalee](https://discourse.openondemand.org/u/pakalee)\
**Post date:** [October 9, 2024, 9:25pm UTC](https://discourse.openondemand.org/t/extending-batch-connect-app-with-custom-endpoints/3805/3 "2024-10-09T21:25:44Z")

</div>

Jeff, thanks those are good thoughts. The submit.yml.erb method works great (I’ll need to use that as one of our ood installs is still at 1.8 … gasp!)

Final question: Is there a way to change the “Save” title from the exception/message that’s posted?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/b/bae70bd0ed39a3ae769c2108155f4cb3e9da8385.png) [@system](https://discourse.openondemand.org/u/system)\
**Post date:** [April 7, 2025, 9:26pm UTC](https://discourse.openondemand.org/t/extending-batch-connect-app-with-custom-endpoints/3805/4 "2025-04-07T21:26:06Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
