0

I have web api endpoint

[HttpPut]
 public async Task<IHttpActionResult> Rights(
       [FromBody] IEnumerable<Rights> rights,
       [FromBody] IEnumerable<Permissions> permissions)

Any idea how can I pass these two array parameters in the body of the request. My code is something like this

public static async Task Request(this RequestData requestData, Context context)
        {
            var url = requestData.GetAbsoluteUrl();

            byte[] body = Encoding.UTF8.GetBytes(Serialize(requestData.Body, requestData.Body.GetType()));

            using (var client = new CustomWebClient(context, body))
            {
                client.Headers.Add("Content-Type", "application/json");
                await client.UploadAsync(url, requestData.Method.ToString(), body);
            }
        }

1 Answer 1

1
public class RequestBody
{
 public IEnumerable<Rights> rights
 public IEnumerable<Permissions> permissions
}

send this class object as RequestData

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.