Quantcast
Channel: Adobe Community : Unanswered Discussions - ColdFusion
Viewing all articles
Browse latest Browse all 5794

What is script syntax for passing form to REST?

$
0
0

I'm lost. I am attempting to pass a FORMFIELD-parameter via the DELETE-method to a REST-function using script language.

I want to delete a resource. I get "Method not allowed", only "GET,OPTIONS,HEAD", so the DELETE-method is not understood.


I would apprechiate any meaningful input.

 

---------(service call)-------------

form.CategoryIDDelete = "X,Y,Z"

httpSvc = new http();
httpSvc.setMethod("DELETE");
httpSvc.setCharset("utf-8");
httpSvc.addParam(type="formfield", name="CategoryIDDelete", value="#FORM.CategoryIDDelete#");
httpSvc.setUrl("http://data.myDomain.net/rest/restService/categories"); 
res = httpSvc.send().getPrefix();
writeDump(res);
writeDump(FORM);

------------------------------------

 

...calls the rest service function in the registred REST component.
Here I call CategoryIDDelete "catIDs".

 

---------(service function)---------

 

remote Array function delCategory(string catIDs restArgSource="FORM") httpMethod="DELETE" restpath="{catIDs}" produces="application/json" {
 
  var resp = [];

  if (len(catIDs) > 0) {
    ...                         
  }
  return resp;
 
}

-------------------------------------

 

I am uncertain about many things; restArgSource="FORM", restPath="{catIDs}", and why DELETE is not an allowed method.


Viewing all articles
Browse latest Browse all 5794

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>