I have to make this request in rails 6:
curl --location --request POST 'https://api.web2sms237.com/sms/send' \
--header 'Content-Type: application/json' \
--data-raw '{
"sender_id": "MyApp",
"phone":"+237699112233",
"text":"Web2Sms237 is an awewome app!",
"flash":false
}'
We usually use HTTParty to make http requests, but i faced some problems trying to pass raw data into the request. I’ve already tried:
result = HTTParty.post(
"https://api.web2sms237.com/sms/send",
headers: {
"Content-Type": "application/json",
},
body: {
sender_id: App.first.name.upcase,
phone: "+237#{@phone}",
text: @message,
flash: false
})
And in all cases, the response says that no data was passed (all my dara are ok) how can i solve this issue
{"message":"The given data was invalid.","errors":{"phone":["The phone field is required."],"text":["The text field is required."]}}