1

I am new to the usage of remote REST APIs and was wondering if there was anyone who has any experience with connecting and using the REST API from Pronto Forms.

Although this product offers examples using curl, there are no concrete examples provided for applications. Beyond setting up an API key within my user profile, from an authentication perspective, the minimal online documentation merely cites the fact that their API is very standard (I can accept that) and that basic authentication is used over https.

I have been digging on the various RoR pages and found the Faraday gem to provide some good functionality for creating connections using basic authentication, and then enabling easy RESTful interactions with the remote connection. Yet, I have not been able to successfully authenticate, and all the responses I am receiving from the remote server return status 302 and seem to cite a redirect to 'api.prontoforms.com/login'.

Strangely, when I try to access any of the REST resources from a plain browser, I am able to do so. The browser simply prompts me with a username and password. When I use my regular login information, there is no authotization, but when I enter the API credentials, things seem OK. This is despite the fact that the 'API KEY' and 'API KEY SECRET' pair are not 'username' and 'password' per se. I don't believe that pronto forms uses oauth or oauth2.

My questions are as follows:

  1. When performing basic authentication, are 'API KEY' and 'API KEY SECRET' equivalent to 'username' and 'password'? Is this just a matter of wording?
  2. Is there something I'm missing in trying to create a connection using faraday:

    @conn = Faraday.new(:url => 'https://api.prontoforms.com/api/1') do |faraday|
         faraday.adapter Faraday.default_adapter
         faraday.basic_auth('<API_KEY>', '<API KEY SECRET>')
         faraday.headers['Content-Type'] = 'application/json'
    end
    
    @response = @conn.get '/data.json'
    

Any experiences or pointers?

panagioti
  • 426
  • 4
  • 14

0 Answers0