# HTTP 500 for create\_all.json

**URL:** <https://forum.beeminder.com/t/http-500-for-create-all-json/558>\
**Category:** Bugabee\
**Created:** [March 3, 2015, 3:39pm UTC](https://forum.beeminder.com/t/http-500-for-create-all-json/558 "2015-03-03T15:39:51Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![bee](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/bee/32/41_2.png) [@bee](https://forum.beeminder.com/u/bee)\
**Post date:** [March 4, 2015, 5:18am UTC](https://forum.beeminder.com/t/http-500-for-create-all-json/558/2 "2015-03-04T05:18:04Z")

</div>

The problem here is that you were passing in a proper form/urlencoded array of datapoints, while we were expecting a json-encoded string representation of the same. Which is kind of weird, and poorly documented [1], so shame on us!

The trouble here is deep… we return json data through the api, but we don’t really _accept_ json data posted to the api – it’s all x-www-form-urlencoded data.

If you want to pass in a thing like an array of arrays (`roadall`), or an array of datapoint parameters (`create_all`), we were asking you to construct your array, then turn it into a json-parsable string, pass us that, then we parse the string as json on our end.

This is admittedly surprising / confusing (perhaps we should make it [an _actual_ json api for v2](http://forum.beeminder.com/t/api-version-2-planning-and-wishlist/509/4)). You _can_ send nested lists and things with x-www-form-urlencoded data as well, but it’s kinda ugly [2] if you’re trying to curl things, for example. Of course if you have a nice civilized library doing the dirty work on your http calls it’s beneath you to worry about such things anyway. So what I just did makes it so you can submit form-data-url-encoded arrays, or you can submit the json-encoded string version.

This should work for both `roadall` and `datapoints#create_all` in the api now.

[1] I think this used to be better documented and we may have murked it up in the past several months. I believe this because I know that people have successfully used the `datapoints#create_all` endpoint in the past. Sorry!

[2] this example is borrowed from [HTTParty](https://github.com/jnunemaker/httparty "My favorite kind of party")

```ruby
@example
  # { name: "Bob",
  # address: {
  # street: '111 Ruby Ave.',
  # city: 'Ruby Central',
  # phones: ['111-111-1111', '222-222-2222']
  # }
  # }.to_params
  # => "name=Bob&address[city]=Ruby Central&address[phones][]=111-111-1111&address[phones][]=222-222-2222&address[street]=111 Ruby Ave."

```

---

_[View the full topic](https://forum.beeminder.com/t/http-500-for-create-all-json/558)._
