How do I accept a JSON array of integers in a POST request body?

I have an entity in my application called "proposal". A proposal can have many "service" entities. I will create a proposal first, then I'll want to add/associate multiple servies with it. I was creating the following API endpoint:

proposal/{proposal_id}/services

I want to some something like the following:

POST proposal/215/services

[
  1,
  3
]


The array in the body would be the ids of the services I want to associate with the proposal specfied by the path param.

I can seem to figure how to do this. I'm getting errors when I create an input for the proposal ID and an array of integers. It seems like it's forcing me to combine everything in a more complex JSON in the body.

1
8 replies