Java code to implement RSpace FileStore operations to Egnyte
This library uses Spring Rest Template client to wrap calls to Egnyte File and Search API. All calls require a valid access token.
-
Get an API key
-
Get access token using call like:
curl --request POST -H "Content-Type: application/x-www-form-urlencoded" -d grant_type=password -d username= -d 'password=' -d client_id= https://apprspace.egnyte.com/puboauth/token
which should return a value like:
{"access_token":"<token>","token_type":"bearer","expires_in":-1}
This is a separate, module independent of RSpace code, but as it will eventually be part of RSpace webapp - there is a dependency on parent pom.xml to keep consistent library versions and avoid classpath hell at runtime.
Acceptance tests make real calls to Egnyte. A proxy class APiExecutor
that wraps test API call limits calls to once per 750 millis, which should work as the documented limit is 2 per second.
-
Edit
test.properties
so that the value ofegnyte.url
is the URL of your Egnyte instance. Make sure the URL ends with a trailing slash, e.g.https://apprspace.egnyte.com/
. -
Set your access token as a system property using a -D option to your test runner, e.g. if using Maven
mvn clean test -DaccessToken=abcdefghijk
See acceptance tests in package com.researchspace.egnyte.api2
for usage examples.