# Passing params to delete API method using golang

**URL:** <https://meta.discourse.org/t/passing-params-to-delete-api-method-using-golang/83502>\
**Category:** Development\
**Created:** [March 21, 2018, 6:17pm UTC](https://meta.discourse.org/t/passing-params-to-delete-api-method-using-golang/83502 "2018-03-21T18:17:47Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![richp10](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richp10/32/104381_2.png) [@richp10](https://meta.discourse.org/u/richp10)\
**Post date:** [March 21, 2018, 6:17pm UTC](https://meta.discourse.org/t/passing-params-to-delete-api-method-using-golang/83502/1 "2018-03-21T18:17:47Z")

</div>

Using Go, I am trying to remove a user from a group using the api. I am confident the endpoint is correct - /groups/148/members.json where 148 is the ID of the group.

From the API spec - it seems I use the DELETE method and pass the user id in the body like this.

```
{"user_id":36}

```

When I examine an actual api call from the standard discourse client, it appears to be plain form data like this:

```
user_id=36

```

To try achieve this in Golang, I have created form values like this:

```
form := url.Values{}
form.Add("user_id", strconv.Itoa(discouserid))
body=strings.NewReader(form.Encode())
req, err := http.NewRequest("DELETE", url, body)

```

I also debugged and checked the sent body contains user\_id=36. I also tried this as a json string as shown at the top and that did not work either.

All of these resulted only in a 500 error from the API - I am using Get and Post methods successfully elsewhere which uses the same url / authentication - it is just this delete method which needs form data that I am having trouble with.

Any thoughts\>

---

_[View the full topic](https://meta.discourse.org/t/passing-params-to-delete-api-method-using-golang/83502)._
