-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ysolyne Gresille
committed
Feb 6, 2012
1 parent
b3f50ee
commit 54f42cd
Showing
2 changed files
with
76 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,80 @@ | ||
Phraseanet API javascript SDK | ||
============================= | ||
#Javascript SDK | ||
|
||
Library for interacting with Phraseanet API | ||
|
||
Still in development. | ||
|
||
Please, Do not use this library for the moment. | ||
__Please, Do not use this library for the moment.__ | ||
|
||
|
||
* ##Register a phraseanet instance | ||
|
||
``` | ||
PHRASEA.registerInstance(name, domain, apiKey); | ||
``` | ||
|
||
* ##Get all registered instances from cookies | ||
|
||
``` | ||
var instanceList = PHRASEA.getInstances(); | ||
var instance; | ||
while (instance = instanceList.hasNext()) | ||
{ | ||
//the current instance | ||
} | ||
``` | ||
|
||
* ##Get a previously registered instance | ||
|
||
``` | ||
var myInstance = PHRASEA.getInstance(name, function(instance){ | ||
if(instance) | ||
{ | ||
return instance; | ||
} | ||
else | ||
{ | ||
//handle errors | ||
} | ||
}); | ||
``` | ||
* ##Connect to the instance | ||
|
||
``` | ||
myInstance.connect({options}, function(response){ | ||
if(response.errors) | ||
{ | ||
//handle errors | ||
} | ||
else | ||
{ | ||
//connected | ||
} | ||
}); | ||
``` | ||
|
||
* ##Request to the instance | ||
|
||
``` | ||
myInstance.request("/path/", "METHOD", {params}, function(response){ | ||
if(response.metas.http_code === 403) | ||
{ | ||
//handle errors | ||
} | ||
else | ||
{ | ||
datas = response.datas; | ||
} | ||
}); | ||
``` | ||
|
||
* ##logout to the instance | ||
|
||
``` | ||
myInstance.logout(function(response){ | ||
if(!response.error) | ||
{ | ||
//user logout | ||
} | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,2 @@ | ||
Phraseanet Client Libraries | ||
=========================== | ||
|
||
Phrasea | ||
- | ||
|
||
1. Register a phraseanet instance | ||
|
||
``` | ||
PHRASEA.registerInstance(name, domain, apiKey); | ||
``` | ||
|
||
2. Get all registered instances from cookies | ||
|
||
``` | ||
var instanceList = PHRASEA.getInstances(); | ||
var instance; | ||
while (instance = instanceList.hasNext()) | ||
{ | ||
//the current instance | ||
} | ||
``` | ||
|
||
3. Get a previously registered instance | ||
|
||
``` | ||
var myInstance = PHRASEA.getInstance(name, function(instance){ | ||
if(instance) | ||
{ | ||
return instance; | ||
} | ||
else | ||
{ | ||
//handle errors | ||
} | ||
}); | ||
``` | ||
4. Connect to the instance | ||
|
||
``` | ||
myInstance.connect({options}, function(response){ | ||
if(response.errors) | ||
{ | ||
//handle errors | ||
} | ||
else | ||
{ | ||
//connected | ||
} | ||
}); | ||
``` | ||
|
||
5. Request to the instance | ||
|
||
``` | ||
myInstance.request("/path/", "METHOD", {params}, function(response){ | ||
if(response.metas.http_code === 403) | ||
{ | ||
//handle errors | ||
} | ||
else | ||
{ | ||
datas = response.datas; | ||
} | ||
}); | ||
``` | ||
|
||
6. logout to the instance | ||
|
||
``` | ||
myInstance.logout(function(response){ | ||
if(!response.error) | ||
{ | ||
//user logout | ||
} | ||
}); | ||
``` | ||
=========================== |