> http://wescript.net/

API

Response Status

200
No error.
201
Resource is created successfully.
400
Request parameters is invalid.
404
Resource could not be found.
503
A Server error is occurred.

Script API

Script Details

URL: /scripts/{id}.json
Method: GET
URL: /scripts/?url={url}
Method: GET
URL Variables:
id
script ID
Query Parameters:
url
distribution origin of script
Response:
id
script ID
resource_url
resouce URL
url
distribution origin of script
script_page
script page
created_at
created date and time
updated_at
updated date and time
versions
versions info
users
users info
Example:
GET /scripts/1.json
{
  "id": 1,
  "resouce_url": "http:\/\/wescript.net\/scripts\/1",
  "url": "http:\/\/userscripts.org\/scripts\/source\/8551.user.js",
  "script_page": "http:\/\/userscripts.org\/scripts\/show\/8551",
  "created_at": "2008-10-23T07:10:03Z",
  "updated_at": "2008-10-23T07:10:03Z",
  "versions": [
    {
      "name": "AutoPagerize",
      "updated_at": "2008-10-23T07:10:03Z",
      "url": "http:\/\/userscripts.org\/scripts\/source\/8551.user.js",
      "digest": "840cee0680c8af072b9d94daba841a06",
      "namespace": "http:\/\/swdyh.yu.to\/",
      "id": 1,
      "created_at": "2008-10-23T07:10:03Z"
    },
    {
      "name": "AutoPagerize",
      "updated_at": "2008-10-23T07:10:05Z",
      "url": "http:\/\/userscripts.org\/scripts\/source\/8551.user.js",
      "digest": "5348d241f9b3008ccb3812c4ffc0ef8d",
      "namespace": "http:\/\/swdyh.yu.to\/",
      "id": 2,
      "created_at": "2008-10-23T07:10:05Z"
    }
  ],
  "users": [
    {
      "updated_at": "2008-11-05T06:25:44Z",
      "resouce_url": "http:\/\/wescript.net\/users\/9a74f4bd1089365f688abdca0d400afa",
      "public_id": "9a74f4bd1089365f688abdca0d400afa",
      "created_at": "2008-10-23T07:10:03Z"
    },
    {
      "updated_at": "2008-11-05T06:25:44Z",
      "resouce_url": "http:\/\/wescript.net\/users\/bc2f7062405375500622a711e864e39b",
      "public_id": "bc2f7062405375500622a711e864e39b",
      "created_at": "2008-10-23T07:10:03Z"
    }
  ]
}
    

Scripts List

URL: /scripts.json
Method: GET
Query Parameters:
page
page number (optional)
query
search query (optional)
digest
md5 hash of the script source file (optional)
name_namespace_digest
md5 hash of the value appnended name and namespace (optional)
users_count_threshold
users count threshold. Default value is 1. (optional)
Response: script info
Example:
GET /scripts.json
[
  {
    "name": "Resizable Textarea",
    "updated_at": "2008-11-12T08:36:25Z",
    "script_page": "http:\/\/userscripts.org\/scripts\/show\/12933",
    "url": "http:\/\/userscripts.org\/scripts\/source\/12933.user.js",
    "namespace": "http:\/\/white.s151.xrea.com\/",
    "id": 4,
    "resouce_url": "http:\/\/wescript.net\/scripts\/4",
    "created_at": "2008-11-12T08:36:25Z"
  },
  {
    "name": "GlitchMonkey",
    "updated_at": "2008-10-23T07:10:09Z",
    "script_page": "http:\/\/userscripts.org\/scripts\/show\/9653",
    "url": "http:\/\/userscripts.org\/scripts\/source\/9653.user.js",
    "namespace": "http:\/\/d.hatena.ne.jp\/youpy\/",
    "id": 3,
    "resouce_url": "http:\/\/wescript.net\/scripts\/3",
    "created_at": "2008-10-23T07:10:09Z"
  },
  {
    "name": "LDR Full Feed",
    "updated_at": "2008-10-23T07:10:07Z",
    "script_page": "http:\/\/userscripts.org\/scripts\/show\/22702",
    "url": "http:\/\/userscripts.org\/scripts\/source\/22702.user.js",
    "namespace": "http:\/\/d.hatena.ne.jp\/Constellation\/",
    "id": 2,
    "resouce_url": "http:\/\/wescript.net\/scripts\/2",
    "created_at": "2008-10-23T07:10:07Z"
  },
  {
    "name": "AutoPagerize",
    "updated_at": "2008-10-23T07:10:03Z",
    "script_page": "http:\/\/userscripts.org\/scripts\/show\/8551",
    "url": "http:\/\/userscripts.org\/scripts\/source\/8551.user.js",
    "namespace": "http:\/\/swdyh.yu.to\/",
    "id": 1,
    "resouce_url": "http:\/\/wescript.net\/scripts\/1",
    "created_at": "2008-10-23T07:10:03Z"
  }
]
    

Find Script Update

URL: /scripts/find_update
Method: GET
Query Parameters:
digest
md5 hash of the script source file
private_id
private ID (optional)
Response:
updatable
whether the script can be updated or not
script
script info
using
whether it is what the user is using or not (Only when private ID is transmitted, it is added.)
Example:
GET /scripts/find_update?digest=840cee0680c8af072b9d94daba841a06
[
  {
    "updatable": true,
    "script": {
      "updated_at": "2008-12-10T08:36:45Z",
      "script_page": "http:\/\/userscripts.org\/scripts\/show\/8551",
      "url": "http:\/\/userscripts.org\/scripts\/source\/8551.user.js",
      "id": 1,
      "resouce_url": "http:\/\/localhost:3000\/scripts\/1",
      "users_count": 2,
      "created_at": "2008-10-23T07:10:03Z"
    }
  }
]
    

User API

Create User

URL: /users
Method: POST
Query Parameters:
name
user name (optional)
Response:
name
user name
private_id
private ID
public_id
public ID
resource_url
resouce URL
Example:
POST /users?name=example_user
{
  "name": "example_user",
  "resource_url": "http:\/\/wescript.net\/users\/d3c4af74307a091cd21b43f03290e349",
  "public_id": "d3c4af74307a091cd21b43f03290e349",
  "private_id": "44c821e2-c0ee-4869-8db5-658b800d0282"
}
    

Update User

URL: /users
Method: PUT
Query Parameters:
name
user name (optional)
private_id
private ID
Response:
message
message
Example:
PUT /users/d3c4af74307a091cd21b43f03290e349?name=new_name&private_id=44c821e2-c0ee-4869-8db5-658b800d0282
{
  "message": "success"
}
    

Delete User

URL: /users/{public_id}
Method: DELETE
URL Variables:
private_id
private ID
Response:
message
message
Example:
DELETE /users/d3c4af74307a091cd21b43f03290e349?private_id=44c821e2-c0ee-4869-8db5-658b800d0282
{
  "message": "sucess"
}
     

User Details

URL: /users/{public_id}.json
Method: GET
URL Variables:
public_id
public ID
Response:
name
user name
created_at
created date and time
updated_at
updated date and time
public_id
public ID
resource_url
resouce URL
script
script info
Example:
GET /users/9a74f4bd1089365f688abdca0d400afa
{
  "updated_at": "2008-12-10T08:36:45Z",
  "resouce_url": "http:\/\/wescript.net\/users\/9a74f4bd1089365f688abdca0d400afa",
  "scripts_count": 2,
  "public_id": "9a74f4bd1089365f688abdca0d400afa",
  "scripts": [
    {
      "name": "AutoPagerize",
      "updated_at": "2008-10-23T07:10:05Z",
      "url": "http:\/\/userscripts.org\/scripts\/source\/8551.user.js",
      "digest": "5348d241f9b3008ccb3812c4ffc0ef8d",
      "namespace": "http:\/\/swdyh.yu.to\/",
      "id": 2,
      "created_at": "2008-10-23T07:10:05Z"
    },
    {
      "name": "LDR Full Feed",
      "updated_at": "2008-10-23T07:10:07Z",
      "url": "http:\/\/userscripts.org\/scripts\/source\/22702.user.js",
      "digest": "386f51395ca15ec6a858e012232ad2ce",
      "namespace": "http:\/\/d.hatena.ne.jp\/Constellation\/",
      "id": 3,
      "created_at": "2008-10-23T07:10:07Z"
    }
  ],
  "created_at": "2008-10-23T07:10:03Z"
}
    

User's Activities

URL: /users/{public_id}/activities.json
Method: GET
URL Variables:
public_id
public ID
Query Parameters:
page
page number (optional)
Response:
created_at
created date and time
updated_at
updated date and time
type
activity type
id
activity ID
resource_url
resouce URL
app
aplication name
app_version
application version
script
script info
Example:
GET /users/9a74f4bd1089365f688abdca0d400afa/activities.json
[
  {
    "script": {
      "name": "GlitchMonkey",
      "updated_at": "2008-10-23T07:10:09Z",
      "url": "http:\/\/userscripts.org\/scripts\/source\/9653.user.js",
      "digest": "eb4e9087cc89993f94953839b509d942",
      "namespace": "http:\/\/d.hatena.ne.jp\/youpy\/",
      "id": 4,
      "resource_url": "http:\/\/wescript.net\/scripts\/3",
      "created_at": "2008-10-23T07:10:09Z"
    },
    "updated_at": "2008-10-23T07:14:11Z",
    "type": "Uninstallation",
    "id": 4,
    "resource_url": "http:\/\/wescript.net\/activities\/4",
    "created_at": "2008-10-23T07:14:11Z"
  },
  {
    "script": {
      "name": "GlitchMonkey",
      "updated_at": "2008-10-23T07:10:09Z",
      "url": "http:\/\/userscripts.org\/scripts\/source\/9653.user.js",
      "digest": "eb4e9087cc89993f94953839b509d942",
      "namespace": "http:\/\/d.hatena.ne.jp\/youpy\/",
      "id": 4,
      "resource_url": "http:\/\/wescript.net\/scripts\/3",
      "created_at": "2008-10-23T07:10:09Z"
    },
    "updated_at": "2008-10-23T07:13:11Z",
    "type": "Installation",
    "id": 3,
    "resource_url": "http:\/\/wescript.net\/activities\/3",
    "created_at": "2008-10-23T07:13:11Z"
  },
  {
    "script": {
      "name": "LDR Full Feed",
      "updated_at": "2008-10-23T07:10:07Z",
      "url": "http:\/\/userscripts.org\/scripts\/source\/22702.user.js",
      "digest": "386f51395ca15ec6a858e012232ad2ce",
      "namespace": "http:\/\/d.hatena.ne.jp\/Constellation\/",
      "id": 3,
      "resource_url": "http:\/\/wescript.net\/scripts\/2",
      "created_at": "2008-10-23T07:10:07Z"
    },
    "updated_at": "2008-10-23T07:12:11Z",
    "type": "Installation",
    "id": 2,
    "resource_url": "http:\/\/wescript.net\/activities\/2",
    "created_at": "2008-10-23T07:12:11Z"
  },
  {
    "script": {
      "name": "AutoPagerize",
      "updated_at": "2008-10-23T07:10:05Z",
      "url": "http:\/\/userscripts.org\/scripts\/source\/8551.user.js",
      "digest": "5348d241f9b3008ccb3812c4ffc0ef8d",
      "namespace": "http:\/\/swdyh.yu.to\/",
      "id": 2,
      "resource_url": "http:\/\/wescript.net\/scripts\/1",
      "created_at": "2008-10-23T07:10:05Z"
    },
    "updated_at": "2008-10-23T07:10:11Z",
    "type": "Installation",
    "id": 1,
    "resource_url": "http:\/\/wescript.net\/activities\/1",
    "created_at": "2008-10-23T07:10:11Z"
  }
]
    

Users List

URL: /users.json
Method: GET
Query Parameters:
page
page number (optional)
Response:
created_at
created date and time
updated_at
updated date and time
public_id
public ID
resource_url
resouce URL
Example:
GET /users.json
[
  {
    "updated_at": "2008-12-12T07:07:55Z",
    "resouce_url": "http:\/\/wescript.net\/users\/1d0bf9ec7bf8a4ca96397736087b75f1",
    "scripts_count": 0,
    "public_id": "1d0bf9ec7bf8a4ca96397736087b75f1",
    "created_at": "2008-12-12T07:07:55Z"
  },
  {
    "updated_at": "2008-12-10T08:58:40Z",
    "resouce_url": "http:\/\/wescript.net\/users\/272ac5f0ec50fed59325a77e1ac5a9be",
    "scripts_count": 4,
    "public_id": "272ac5f0ec50fed59325a77e1ac5a9be",
    "created_at": "2008-12-04T05:36:10Z"
  },
  {
    "updated_at": "2008-12-10T08:58:40Z",
    "resouce_url": "http:\/\/wescript.net\/users\/df8b8f6f5ec5b740c6171da8ac6520a1",
    "scripts_count": 1,
    "public_id": "df8b8f6f5ec5b740c6171da8ac6520a1",
    "created_at": "2008-12-03T12:18:25Z"
  },
  {
    "updated_at": "2008-12-10T08:58:40Z",
    "resouce_url": "http:\/\/wescript.net\/users\/f8989b72f25e94a2c2acffde31845842",
    "scripts_count": 1,
    "public_id": "f8989b72f25e94a2c2acffde31845842",
    "created_at": "2008-12-03T12:16:32Z"
  },
  {
    "updated_at": "2008-12-16T07:41:24Z",
    "resouce_url": "http:\/\/wescript.net\/users\/b13431dedc43e965f3e30598dd623d92",
    "scripts_count": 17,
    "public_id": "b13431dedc43e965f3e30598dd623d92",
    "created_at": "2008-12-03T09:49:42Z"
  },
  {
    "updated_at": "2008-12-10T08:58:40Z",
    "resouce_url": "http:\/\/wescript.net\/users\/21c38ca689d74e1be6a6c53591fb1baa",
    "scripts_count": 5,
    "public_id": "21c38ca689d74e1be6a6c53591fb1baa",
    "created_at": "2008-12-03T09:27:39Z"
  },
  {
    "updated_at": "2008-12-10T08:58:40Z",
    "resouce_url": "http:\/\/wescript.net\/users\/b4bc77d8167b476d455128d58bad2cee",
    "scripts_count": 1,
    "public_id": "b4bc77d8167b476d455128d58bad2cee",
    "created_at": "2008-12-03T09:26:56Z"
  },
  {
    "updated_at": "2008-12-10T08:58:40Z",
    "resouce_url": "http:\/\/wescript.net\/users\/242798d803aa116bbbd0dfcb29cb1004",
    "scripts_count": 1,
    "public_id": "242798d803aa116bbbd0dfcb29cb1004",
    "created_at": "2008-12-03T09:11:45Z"
  },
  {
    "updated_at": "2008-12-10T08:58:40Z",
    "resouce_url": "http:\/\/wescript.net\/users\/ff7364f26d2b7cff4fa79e3e7455cc96",
    "scripts_count": 1,
    "public_id": "ff7364f26d2b7cff4fa79e3e7455cc96",
    "created_at": "2008-12-03T08:57:53Z"
  },
]

Activity API

Sending Activity - Install

URL: /installations
Method: POST
Query Parameters:
url
distribution origin of script (url or digest is required)
digest
md5 hash of the script source file (url or digest is required)
private_id
private ID
app
aplication name (optional)
app_version
application version (optional)
Response:
message
message
Example:
POST /installations
?digest=5348d241f9b3008ccb3812c4ffc0ef8d
&private_id=44c821e2-c0ee-4869-8db5-658b800d0282
&app=wescript_client&app_version=0.1
{
  "message": "sucess"
}
    

Sending Activity - Uninstall

URL: /uninstallations
Method: POST
Query Parameters:
digest
md5 hash of the script source file
private_id
private ID
app
aplication name (optional)
app_version
application version (optional)
Response:
message
message
Example:
POST /uninstallations
?digest=5348d241f9b3008ccb3812c4ffc0ef8d
&private_id=44c821e2-c0ee-4869-8db5-658b800d0282
&app=wescript_client&app_version=0.1
{
  "message": "sucess"
}
    

Activity Details

URL: /acrivities/{id}.json
Method: GET
URL Variables:
id
activity ID
Response:
created_at
created date and time
updated_at
updated date and time
type
activity type
id
activity ID
resource_url
resouce URL
app
aplication name
app_version
application version
script
script info
user
user infor
Example:
GET /activities/1.json
{
  "user": {
    "updated_at": "2008-12-17T04:54:37Z",
    "scripts_count": 3,
    "public_id": "9a74f4bd1089365f688abdca0d400afa",
    "created_at": "2008-10-23T07:10:03Z"
  },
  "script": {
    "name": "AutoPagerize",
    "updated_at": "2008-10-23T07:10:05Z",
    "url": "http:\/\/userscripts.org\/scripts\/source\/8551.user.js",
    "digest": "5348d241f9b3008ccb3812c4ffc0ef8d",
    "namespace": "http:\/\/swdyh.yu.to\/",
    "id": 2,
    "created_at": "2008-10-23T07:10:05Z"
  },
  "updated_at": "2008-10-23T07:10:11Z",
  "type": "Installation",
  "id": 1,
  "resource_url": "http:\/\/wescript.net\/activities\/1",
  "created_at": "2008-10-23T07:10:11Z"
}
    

Activities

URL: /activities.json
Method: GET
Query Parameters:
page
page number (optional)
Response: activity info
Example:
GET /activities.json
[
  {
    "script": {
      "name": "GlitchMonkey",
      "updated_at": "2008-10-23T07:10:09Z",
      "url": "http:\/\/userscripts.org\/scripts\/source\/9653.user.js",
      "digest": "eb4e9087cc89993f94953839b509d942",
      "namespace": "http:\/\/d.hatena.ne.jp\/youpy\/",
      "id": 4,
      "resource_url": "http:\/\/wescript.net\/scripts\/3",
      "created_at": "2008-10-23T07:10:09Z"
    },
    "user": {
      "updated_at": "2008-12-10T08:36:45Z",
      "scripts_count": 2,
      "public_id": "b42e319ac33b9df9703f1e1bb4d20492",
      "resource_url": "http:\/\/wescript.net\/users\/b42e319ac33b9df9703f1e1bb4d20492",
      "created_at": "2008-11-12T08:35:40Z"
    },
    "updated_at": "2008-11-12T08:35:40Z",
    "type": "Installation",
    "id": 6,
    "resource_url": "http:\/\/wescript.net\/activities\/6",
    "created_at": "2008-11-12T08:35:40Z"
  },
  {
    "script": {
      "name": "AutoPagerize",
      "updated_at": "2008-10-23T07:10:05Z",
      "url": "http:\/\/userscripts.org\/scripts\/source\/8551.user.js",
      "digest": "5348d241f9b3008ccb3812c4ffc0ef8d",
      "namespace": "http:\/\/swdyh.yu.to\/",
      "id": 2,
      "resource_url": "http:\/\/wescript.net\/scripts\/1",
      "created_at": "2008-10-23T07:10:05Z"
    },
    "user": {
      "updated_at": "2008-12-10T08:36:45Z",
      "scripts_count": 1,
      "public_id": "bc2f7062405375500622a711e864e39b",
      "resource_url": "http:\/\/wescript.net\/users\/bc2f7062405375500622a711e864e39b",
      "created_at": "2008-10-23T07:10:03Z"
    },
    "updated_at": "2008-10-23T07:15:11Z",
    "type": "Installation",
    "id": 5,
    "resource_url": "http:\/\/wescript.net\/activities\/5",
    "created_at": "2008-10-23T07:15:11Z"
  },
  {
    "script": {
      "name": "GlitchMonkey",
      "updated_at": "2008-10-23T07:10:09Z",
      "url": "http:\/\/userscripts.org\/scripts\/source\/9653.user.js",
      "digest": "eb4e9087cc89993f94953839b509d942",
      "namespace": "http:\/\/d.hatena.ne.jp\/youpy\/",
      "id": 4,
      "resource_url": "http:\/\/wescript.net\/scripts\/3",
      "created_at": "2008-10-23T07:10:09Z"
    },
    "user": {
      "updated_at": "2008-12-17T04:54:37Z",
      "scripts_count": 3,
      "public_id": "9a74f4bd1089365f688abdca0d400afa",
      "resource_url": "http:\/\/wescript.net\/users\/9a74f4bd1089365f688abdca0d400afa",
      "created_at": "2008-10-23T07:10:03Z"
    },
    "updated_at": "2008-10-23T07:14:11Z",
    "type": "Uninstallation",
    "id": 4,
    "resource_url": "http:\/\/wescript.net\/activities\/4",
    "created_at": "2008-10-23T07:14:11Z"
  },
  {
    "script": {
      "name": "LDR Full Feed",
      "updated_at": "2008-10-23T07:10:07Z",
      "url": "http:\/\/userscripts.org\/scripts\/source\/22702.user.js",
      "digest": "386f51395ca15ec6a858e012232ad2ce",
      "namespace": "http:\/\/d.hatena.ne.jp\/Constellation\/",
      "id": 3,
      "resource_url": "http:\/\/wescript.net\/scripts\/2",
      "created_at": "2008-10-23T07:10:07Z"
    },
    "user": {
      "updated_at": "2008-12-17T04:54:37Z",
      "scripts_count": 3,
      "public_id": "9a74f4bd1089365f688abdca0d400afa",
      "resource_url": "http:\/\/wescript.net\/users\/9a74f4bd1089365f688abdca0d400afa",
      "created_at": "2008-10-23T07:10:03Z"
    },
    "updated_at": "2008-10-23T07:12:11Z",
    "type": "Installation",
    "id": 2,
    "resource_url": "http:\/\/wescript.net\/activities\/2",
    "created_at": "2008-10-23T07:12:11Z"
  },
]
    

Session API

Login

URL: /session
Method: POST
URL: /login
Method: POST or GET
Query Parameters:
private_id
private ID
redirect_to(optional)
redirect path
Response: redirect to user page, or redirect_to parameter path.
Example:
GET /login?private_id=44c821e2-c0ee-4869-8db5-658b800d0282
Status: 302 Found
Location: http://wescript.net/users/d3c4af74307a091cd21b43f03290e349
    

Logout

URL: /session
Method: DELETE
URL: /logout
Method: POST or GET
Query Parameters:
redirect_to(optional)
redirect path
Response: redirect to top page, or redirect_to parameter path.
Example:
GET /logout
Status: 302 Found
Location: http://wescript.net/