0

I have a service in which I would like to be able to send an array of Ids with a single http.delete. So far I have the following:

`
removeLeaguePictures(leaguePics: LeaguePicture[]) {
    const options = {
      headers: new HttpHeaders({
        "Content-Type": "application/json"
      }),
      body: {
        idss: JSON.stringify(leaguePics.map(lp => lp.id))
      }
    };
    return combineLatest([
      this.leaguePictures$,
      this.http.delete<boolean>(this.galleryUrl, options)
    ]).pipe(...)
`

this however does not seem to be sending the list or I just do not know how to retrieve it on the back end Asp.Net core endpoint

In my backend server I have the following action :

`
[HttpDelete]
    public async Task<ActionResult<bool>> Delete([FromBody] long[] ids)
    {...}
`

But I cannot get the ids array to be populated. Any ideas what I am doing wrong?

1 Answer 1

1

Try it a little bit different:

const options = {
  headers: new HttpHeaders({
    "Content-Type": "application/json"
  }),
  body: JSON.stringify(leaguePics.map(lp => lp.id))
}
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.