api - Ruby HTTP request 401 Unauthorized -
We received a request to change this API request, however our Ruby God had left a few months ago and we have only one site This is what it uses. What I currently have in the code given below and I have been able to fix any syntax errors, or I think it is really working with Ruby on my second day.
This phone number is designed to send it and you receive an SMS. Although I'm running in error 401
I just do not know if it's a big deal to remove the AIST code or now just felt like a good thing
The original The form is how the requirements for me were presented and I had already tried to reuse the places.
{"msisdns": ["phone number"], "mobileflow": "xxxxxxxx"}
The following headers should be included together Post:
'Content-Type: Application / Jason', 'Accept: Application / Jason', 'Authority: xxxx-xxx-xxxx'
The code is:
def mobile_club is required 'rest_client' phone_number = params [: phone_number] .gsub (/ [^ 0-9] /, "") if (phone_number.length! = 10) Readings_to '/ whats-fresh / sky-connect', notice: 'Please enter 10 digit phone number' Return and Phone_Namb = "+ 1 # {phone_number}" $ auth = 'basic', 'authorization: xxxx-xxx- xxxx-xxxx-xxxx' response = rest client post "http://go2advertisingmobile.com/api/v1/messaging/sendContent ", {'Msisdns' = & gt; [Phone_number], 'Mobileflow' = & gt; 'Xxxxxxxxxxxxxxxxxxx'}. To_json ,: content_type = & gt; : Json ,: Accept & gt; : Json ,: Authority = & gt; $ Auth puts the response code if feedback.code == 201 redirect_to '/ whats-fresh / lets-connect', notice: 'Thanks for signing up for the mobile club!' Other logger Debug Reserved Reputation To '/ What's-Fresh / Sky-Connect', Notice: "Mobile Club Sign Up Failed (# {response.to_str})" End End
I appreciate all help I and Indicator
Comments
Post a Comment