Calling methods that need authorization
edocr uses OAuth for authentication. You can view a detailed specification of OAuth here.
oauth_consumer_key: The consumer key of your application
oauth_timestamp: The timestamp obtained from your system clock. Your timestamp should not exceed the timestamp set on our server by more than 5 minutes.
oauth_signature: All the requests to edocr API methods must be signed. The default signature method supported by edocr is HMAC-SHA1. Guidelines to sign a request in accordance with OAuth is given here.
oauth_signature_method (optional): This parameter must be specified, in case the signature method is not HMAC-SHA1.
Example request :
The reponse will be in the following format.
oauth_consumer_key: The consumer key of your application
oauth_timestamp: The timestamp obtained from your system clock. Your timestamp should not exceed the timestamp set on our server by more than 5 minutes.
oauth_token:The key of the Request-token.The Request-Token has an expiry time of 30 minutes.
oauth_callback:The callback url of your application
oauth_signature: All the requests to edocr API methods must be signed. The default signature method supported by edocr is HMAC-SHA1. Guidelines to sign a request in accordance with OAuth is given here.
oauth_signature_method (optional): This parameter must be specified, in case the signature method is not HMAC-SHA1.
Example request :
oauth_consumer_key: The consumer key of your application
oauth_timestamp: The timestamp obtained from your system clock. Your timestamp should not exceed the timestamp set on our server by more than 5 minutes.
oauth_token: The key of the Request-token. The Request-Token has an expiry time of 30 minutes.
oauth_signature: All the requests to edocr API methods must be signed. The default signature method supported by edocr is HMAC-SHA1. Guidelines to sign a request in accordance with OAuth is given here.
oauth_signature_method (optional): This parameter must be specified, in case the signature method is not HMAC-SHA1.
Example request :
The response will be in the following format.
oauth_consumer_key: The consumer key of your application
oauth_timestamp: The timestamp obtained from your system clock. Your timestamp should not exceed the timestamp set on our server by more than 5 minutes.
oauth_token:The key of the Access-Token. The Access-Token has an expiry time of 1 week.
method: The name of the API method to be called. The complete list of edocr API methods is given here .
oauth_signature: All the requests to edocr API methods must be signed. The default signature method supported by edocr is HMAC-SHA1. Guidelines to sign a request in accordance with OAuth is given here.
oauth_signature_method (optional): This parameter must be specified, in case the signature method is not HMAC-SHA1.
< any other required additional parameter for the particular API method >
Example request :
The response will be in the following format.
1. Obtain API key
The consumer can avail API key and secret (consumer-key and consumer-secret) by applying for API keys here. The consumer's API keys will be listed under 'API keys' tab in the user's profile page.2. Request Request-Token
The consumer should first request for a Request-Token. An authentic request will be replied with a valid Request-Token key and secret. The Request-Token has an expiry time of 30 minutes. The request for a Request-Token should contain the following parameters :
Request-Token endpoint : http://www.edocr.com/api/request_token
Example request :
http://www.edocr.com/api/request_token?oauth_consumer_key=4c12fc3ff1adab2c32c657e80008ce88&oauth_timestamp=1231221037&oauth_signature=7%2FRpUxSFUPLveX7jHDl3xfrUlKI=
The reponse will be in the following format.
{"status":"ok","requestToken":{"key":"7e852698b3c4b66991a9e581a8a85ddd","secret":"c53ce717a5749a5af1f4d6b79519fa9d"}}
3. Authorize Request-Token
After the consumer has obtained the Request-Token key and secret, the user can be redirected to edocr authorization page so that the user can authorize the Request-Token. The request should contain the following parameters :
Authorization endpoint : http://www.edocr.com/api/authorize
Example request :
http://www.edocr.com/api/authorize?oauth_callback=http%3A%2F%2Fconsumerpage&oauth_consumer_key=4c12fc3ff1adab2c32c657e80008ce88&oauth_timestamp=1231221038&oauth_token=e0a837cf182c9fdf59a4a375114f0f5b&oauth_signature=NhT%2FtPTmohoNrV%2BkKc%2Fx2nfAYCA=
4. Request Access-Token
Once the user has authorized, the consumer can request for an Access-Token. An authentic request will be replied with an Access-Token key and secret. The Access Token has an expiry time of 1 week.The request for an Access-Token should contain the following parameters :
Access-Token endpoint : http://www.edocr.com/api/access_token
Example request :
http://www.edocr.com/api/access_token?oauth_consumer_key=4c12fc3ff1adab2c32c657e80008ce88&oauth_timestamp=1231221407&oauth_token=e0a837cf182c9fdf59a4a375114f0f5b&oauth_signature=QZNHc97R%2Fv3T6gKsmNo2yB%2FssPU=
The response will be in the following format.
{"status":"ok","accessToken":{"key":"bc3f5b3459c0cb9444d52ec2c524c64b","secret":"c715b887e6fb5f35277576f49437b1ff"}}
5. Call API method
The consumer can make API calls with the Access-Token. An API request should contain the following parameters :
API call endpoint : http://www.edocr.com/api/echo_api
Example request :
http://www.edocr.com/api/echo_api?docid=4424&method=edocr.getDocUserRating&oauth_consumer_key=4c12fc3ff1adab2c32c657e80008ce88&oauth_timestamp=1231226978&oauth_token=bc3f5b3459c0cb9444d52ec2c524c64b&oauth_signature=4O1zM2KjNG24EoR25d3LnQSirZ8=
The response will be in the following format.
{"status":"ok","stars":4}