API Overview: Difference between revisions

From Safe Creative API
Jump to navigation Jump to search
w>Jguillo
No edit summary
w>Jguillo
No edit summary
Line 59: Line 59:
See [[API callbacks]]
See [[API callbacks]]


* [[User Key callback URL]]
The API server will use your callback URL to send your application several notifications.
* [[User Key bringback URL]]
 
* [[Authkey: The user authorization]]
= Error handling =
 
See [[Error handling]]
 
Invalid parameters or requests return an error, server-side problems return an exception.
 
 
 
 
* [[Error handling]]
* [[Error handling]]
* [[About users]]
* [[About users]]
Line 70: Line 78:
* [[API Arquitecture]]
* [[API Arquitecture]]


= API functions reference =
= See also =
== Generic methods ==
* [[API reference]]
* [[version]]
* [[How to]]
* [[ztime]]
* [[Troubleshooting]]
* [[authkey.create]]
* [[authkey.state]]
== User management ==
* [[user.link]]
* [[user.modify]]
* [[user.unlink]]
== Master tables ==
* [[user.licenses]]
* [[license.features]]
* [[user.countries]]
* [[user.profiles]]
* [[work.types]]
* [[work.types.tree]]
* [[work.languages]]
== Works info ==
* [[work.get]]
* [[work.get.private]]
* [[work.list]]
* [[work.certificate]]
* [[work.download]]
* [[work.download.private]]
== Work management ==
* [[work.upload.lookup]]
* [[work.upload.begin]]
* [[work.upload.chunk]]
* [[work.upload.commit]]
* [[work.register]]
* [[work.attachfile]]
* [[work.delete]]
== Multiauthorship ==
* [[work.rightsholders.add]]
* [[work.rightsholders.list]]
* [[work.rightsholders.remove]]
== Search ==
* [[search.byquery]]
* [[search.byfields]]
* [[search.byhash]]
* [[semantic.query]]
 
= How to =
* [[Register work uploading]]
* [[Register work via URL]]
* [[Register work with extended info]]
* [[Register work with relations]]
* [[Desktop Applications]]
 
= Troubleshooting =
* [[Signatures]]
* [[Charsets]]
* [[Callbacks]]

Revision as of 12:14, 4 May 2010

Obtaining the keys to use the API

You must have a Safe Creative Account to use the API. You can create your API key at https://www.safecreative.org/new-api-key You will fill a form with some data that Safe Creative reviews in order to make the final authorization to use the application key:

  • Name: Name of the application that will use the Safe Creative API, it's a public name shown when an authorization to the user is made
  • Shared key: Provided shared key used to identify the applications calls
  • Private key: Provided private key to sign some API requests
  • Description: Public description of the service provided by the application
  • Web site: Public URL of the site of the application
  • API callback URL: Private URL used by Safe Creative to notify different types of events. See API callbacks
  • API bringback URL: URL provided to the client user as the final step of key authorization. i.e., user will be redirect to this url after authorizing your application. See User authorization.
  • Notes: Private notes for the Safe Creative Team in order to obtain the activation of the keys

After some days you will obtain the activation of these keys, so you can use the Safe Creative API. Once you have requested an API key, you can manage your API keys from the API keys tab on My account

It is strongly encouraged to use the arena environment for testing the API before using your application on the real service. To do so, you must request your application key at https://arena.safecreative.org/new-api-key instead. Your application key will be immediately activated, so you can start testing the API.

Accessing the API

Safe Creative API Web Services are accessible via a REST-like interface. The interface is rooted at http://api.safecreative.org/v2/ unless you are using the arena server that lives in the arena subdomain: http://arena.safecreative.org/v2/.

All requests must be done using the UTF-8 charset (HTTP request charset should be UTF-8). Responses are formatted as UTF-8 XML. It is strongly recommended to use HTTPS instead of HTTP. Some methods are required to be called using HTTPS.

Parameters

Parameters can be sent by POST or GET. You can mix POST and GET parameters. Some operations must send xml parameters that are best suited for POST method, but this is not required.

There are some common parameters: locale, sharedkey, ztime, authkey, signature, component and format

  • component is the name of the method or function to execute
  • sharedkey is the key assigned to the application. It has an associated private key.
  • locale is used to translate some messages to the specified locale. Locale format is language-country-variant, e.g. en-US
  • ztime is the number of milliseconds since January 1, 1970, 00:00:00 GMT (see ztime parameter). You can use the ztime component to retrieve the server ztime for synchronization
  • authkey is the user authorization for the application to use his account. It has an associated private key.
  • signature is a hash of the request computed using the private key associated to the sharedkey or authkey (depending on the component being called). See signature parameter.
  • format specifies the response format: xml (default) or json

URL syntax

API calls usually have the following format:

http://api.safecreative.org/v2/?component={component}&parameter1=value1&parameter2=value2&ztime={ztime}&signature={signature}

Some operations do not require a signature, so you can avoid calculating and sending it. The same can be said for the ztime

User authorization

See user authorization

In order to register works for a user, you need that user's authorization. User's authorizations are represented by an authkey.

You create an authkey with authkey.create. Then you must redirect your user to the user authorization page, where he must complete the authorization process. Once authorization is complete, user will be redirected to you user bringback URL.

Callbacks

See API callbacks

The API server will use your callback URL to send your application several notifications.

Error handling

See Error handling

Invalid parameters or requests return an error, server-side problems return an exception.



See also