3

I'm pretty new to Marketing Cloud. I'm trying to add some data to a data extension. I'm able to connect and get a token just fine but when I try to send even a blank request to what should be a valid data extension I get a 403 error.

I can't find anything in the documentation of doing anything other than getting a token so if someone can point me in the direction of an example of how I can access the API using Ruby I'd appreciate it. This is what the two relevant methods look like from my class

def connect
  @result = HTTParty.post('https://auth.exacttargetapis.com/v1/requestToken',
           :body => { :clientId => @client_id,
                      :clientSecret => @client_secret,
                    }.to_json,
            :headers => { 'Content-Type' => 'application/json' } )
end

def update_groups
  @auth = HTTPParty.post('https://www.exacttargetapis.com/hub/v1/dataevents/<data-extension-external-key>/rowset',
  :body => {}.to_json,
  :headers => {'Content-Type' => 'application/json',
               'Authorization' => "Bearer #{@access_token}"})
end

The result I get when I call update_groups is

parsed_response={"documentation"=>"https://code.docs.exacttarget.com/rest/errors/403", "errorcode"=>0, "message"=>"Not Authorized"}, @response=#<Net::HTTPUnauthorized 401 Unauthorized readbody=true>, @headers={"server"=>["Apache-Coyote/1.1"], "x-mashery-responder"=>["04-13"], "x-mashery-error-code"=>["ERR_403_NOT_AUTHORIZED"], "www-authenticate"=>["Bearer realm=\"www.exacttargetapis.com\""], "x-mashery-message-id"=>["56cff11a-619d-4b48-8fd3-cc2aa0456550"], "content-type"=>["application/json;charset=UTF-8"], "content-length"=>["110"], "date"=>["Mon, 07 Mar 2016 16:49:07 GMT"], "connection"=>["close"]}

that documentation link goes nowhere and I can't find a Not Authorized message in the Rest API documentation either.

Any help is gratefully accepted!

1 Answer 1

0

It turns out the @access_token was blank once I changed that and just used a JSON string in place of the body I was able to connect properly..

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .