0

Well, i'm building an application in rails and i'm locked in a task.

The issue is that i need to upload a json file containing the result of a SQL query to this url: http://api-segura.herokuapp.com/consultaPetianos, where the view of my application will get the data requested.

I already have the json string, but my question is, how can I submit this string(or file) to the given url?

Obs: the application is hosted in Heroku.

  • you need to expose an api endpoint from your heroku application. This should ideally be a POST request which sends payload in form of json -> reaches your application --> deciphered --> persisted --> 200 OK – kiddorails Sep 28 '17 at 18:43

1 Answers1

0

If this is a one time deal, one easy option is to use curl. There are quite a few questions on here about posting json using curl. Check here for more info.

curl -X POST -H "Content-Type: application/json" -d '{"key":"val"}' URL

chanderhan
  • 41
  • 3