I am having trouble building a POST request that should accept a CSV of a persons phone numbers ie. phoneNum1,phoneNum2,phoneNum3...phoneNum350
and then return a JSON object of those phone numbers that matched already in the database. I am testing with the chrome extension POSTMAN as such:
yet it returns ERROR 404
upon execution.
How can I reformulate this request to work?
the action:
def getActivatedFriends
@results = BusinessUser.find_by_sql("SELECT
a.id
, a.username
, a.phoneNumber
FROM sers a
WHERE phoneNumber in (" + params[:friends_phone_number_csv].to_s + ") and
removed = 0 and
is_user = 1;")
respond_to do |format|
format.html
format.json { render json: { friends_match: @results }}
end
end
the route:
match '/getActivatedFriends/:friends_phone_number_csv',
to: 'requests#getActivatedFriends', via: 'post',
constraints: { friends_phone_number_csv: /([0-9]+,?)+/ }