# Web Dev Custom Method

**URL:** <https://forum.inductiveautomation.com/t/web-dev-custom-method/84150>\
**Category:** Ignition\
**Created:** [January 11, 2024, 9:48pm UTC](https://forum.inductiveautomation.com/t/web-dev-custom-method/84150 "2024-01-11T21:48:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@Jonathan](https://forum.inductiveautomation.com/u/Jonathan)\
**Post date:** [January 11, 2024, 9:48pm UTC](https://forum.inductiveautomation.com/t/web-dev-custom-method/84150/1 "2024-01-11T21:48:44Z")

</div>

Is there a way to add custom methods to the Web Dev module. For instance, I want a python resource to have a HTTP method called RESET. Then in my HTTP Method drop down I would have a selection for doReset.

If that is not possible is there other suggestions about how to best go about doing something like this that will scale? For example, using POST but in the request include a key for the method/action trying to be performed on the resource.

---

<div class="post-metadata">

**Author:** ![calimero100582](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/calimero100582/32/18630_2.png) [@calimero100582](https://forum.inductiveautomation.com/u/calimero100582)\
**Post date:** [January 11, 2024, 9:54pm UTC](https://forum.inductiveautomation.com/t/web-dev-custom-method/84150/2 "2024-01-11T21:54:34Z")

</div>

HTTP method are standards

> **[HTTP request methods - HTTP | MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods)**
>
> HTTP defines a set of request methods to indicate the desired action to be performed for a given resource. Although they can also be nouns, these request methods are sometimes referred to as HTTP verbs. Each of them implements a different semantic,...

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 11, 2024, 9:56pm UTC](https://forum.inductiveautomation.com/t/web-dev-custom-method/84150/3 "2024-01-11T21:56:10Z")

</div>

> [@Jonathan](#):
>
> using POST but in the request include a key

Do this. Going outside the HTTP specification (the allowed methods are listed in the spec, with no indication that users can make up their own) is begging for trouble, especially when your traffic passes through a proxy somewhere.

---

<div class="post-metadata">

**Author:** ![Jonathan](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@Jonathan](https://forum.inductiveautomation.com/u/Jonathan)\
**Post date:** [January 11, 2024, 10:07pm UTC](https://forum.inductiveautomation.com/t/web-dev-custom-method/84150/4 "2024-01-11T22:07:09Z")

</div>

So, are you both in favor of using a post and embedding the action/method name in the post data?

How about this way of doing it? Can this be used somehow in WebDev?

> POST /files/a/long/file/name:undelete

where undelete is my custom method. How would I parse this URL path and get this custom method.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 11, 2024, 10:15pm UTC](https://forum.inductiveautomation.com/t/web-dev-custom-method/84150/5 "2024-01-11T22:15:17Z")

</div>

General conventions around REST/web APIs suggest the URL indicating the "noun" and the data in the POST payload containing the associated context. You can choose any serialization method you wish, though JSON is common and well supported in Webdev.

---

<div class="post-metadata">

**Author:** ![Jonathan](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@Jonathan](https://forum.inductiveautomation.com/u/Jonathan)\
**Post date:** [January 11, 2024, 10:20pm UTC](https://forum.inductiveautomation.com/t/web-dev-custom-method/84150/6 "2024-01-11T22:20:15Z")

</div>

Looks like I can use the remainingPath request parameter to get any trailing resource, but the :undelete does not seem to be in there. I guess I will have to go with embedding the method/action in the post data.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 11, 2024, 10:30pm UTC](https://forum.inductiveautomation.com/t/web-dev-custom-method/84150/7 "2024-01-11T22:30:31Z")

</div>

If you want to pass a parameter in the URL, use the standard mechanism: `path/to/endpoint?paramName=paramValue`.

Again, well supported by Webdev, HTTP clients, etc.
