Passing Data in PUT Calls


#1

I have this type and function

@restful(endpoint='flags')
entity type Flags schema name "FLAGS" {
  @restful(subPath='v1/setFlags')
  setFlagsV1: function(parameters: [json]): json js server
}

and right now, the function setFlagsV1 is defined as:

function setFlagsV1(parameters){
return parameters;
}

if I use the input:

{
  "parameters": [{
    "id": "123"
  }]
}

I can call the url: https://tennant-url/api/1/TennatName/TagName/flags/v1/setFlags

with a post call and I get the expected output\

[{
    "id": "123"
  }]

but, when I try to do a put call on the same url, I get:

[]

How do you do pass data using a put call into a function?


#2

I don’t know but are you building a feature flagging tool? Tell me about it!


#3

Yea, we are building an api that can write data. Anytime this api is called, an event would be created and some flags would be set. I talked with our internal team and they mentioned that it makes sets to use a PUT call as the API call because from the user perspective they are modifying some flags.


#4

see the in-depth document: ‘rest-binding’