Skip to content

Instantly share code, notes, and snippets.

@dklassen
Created July 22, 2016 14:46
Show Gist options
  • Save dklassen/e5fe0e7f42c1c8521e0e5659af78cbd9 to your computer and use it in GitHub Desktop.
Save dklassen/e5fe0e7f42c1c8521e0e5659af78cbd9 to your computer and use it in GitHub Desktop.
Golang Lever API

When making a POST request to lever API via golang you need to be able to send an array in somecases. For example, when updating tags ["test1", "test2"]. In python using the requests lib didn't have this issue but perhaps can save some time because it wasn't obvious right away:

data := url.Values{"tags[]": []string{"test", "test1"}}

req, err := http.NewRequest("POST", "https://api.lever.co/v1/candidates/132412-12312-1241/addTags?perform_as=1341-1243124", strings.NewReader(data.Encode()))
req.Header.Set("Content-Type", "application/x-www-form-urlencoded") // <- Don't forget the header!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment