Metamaps API documentation version 2.0
https://metamaps.cc/api/v2
/maps
get /maps
Query Parameters
- user_id: (number)
Pass a user_id to only return maps created by that user. For example,
/api/v2/maps?user_id=1
would return maps created by the Metamaps user with id 1. - q: (string)
Search text columns for this string. A query of
"example"
will be passed to SQL asLIKE %example%
. The searchable columns are:name, desc
- searchfields: (string)
A comma-seperated list of columns to search. For instance, to search a topic's name and description (but not link field) for the string "cognition", you could use
?q=cognition&searchfields=name,desc
. - embed: (string)
Comma-separated list of columns to embed. Each embedded column will be returned instead of the corresponding
field_id
orfield_ids
column. For instance,?embed=user
would remove theuser_id
integer field from a response and replace it with auser
object field.Possible embeddable fields are:
user,source,topics,synapses,mappings,contributors,collaborators
- sort: (string)
The name of the comma-separated fields to sort by, prefixed by "-" to sort descending
- page: (integer - default: 1)
The page number
- per: (integer - default: 25)
Number of records per page
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": [
{
"id": 2,
"name": "Emergent Network Phenomena",
"desc": "Example map for the API",
"permission": "commons",
"screenshot": "https://s3.amazonaws.com/metamaps-assets/site/missing-map.png",
"starred": false,
"created_at": "2016-03-26T08:02:05.379Z",
"updated_at": "2016-03-27T07:20:18.047Z",
"user_id": 1234,
"source_id": 2,
"topic_ids": [
58,
59
],
"synapse_ids": [
2
],
"mapping_ids": [
94,
95,
96
],
"collaborator_ids": [],
"contributor_ids": [
2
]
}
],
"page": {
"current_page": 1,
"next_page": 2,
"prev_page": 0,
"total_pages": 5,
"total_count": 5,
"per": 1
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
post /maps
Body
Type: application/json
Properties- name: required (string)
name
- desc: required (string)
description
- permission: required (string)
commons, public, or private
- source_id: required (string)
the id of the map this map is a fork of
- screenshot: required (string)
url to a screenshot of the map
- contributor_ids: required (string)
the ids of people who have contributed to the map
- collaborator_ids: required (string)
the ids of people who have edit access to the map
HTTP status code 201
Body
Type: application/json
Examples:
{
"data": {
"id": 2,
"name": "Emergent Network Phenomena",
"desc": "Example map for the API",
"permission": "commons",
"screenshot": "https://s3.amazonaws.com/metamaps-assets/site/missing-map.png",
"starred": false,
"created_at": "2016-03-26T08:02:05.379Z",
"updated_at": "2016-03-27T07:20:18.047Z",
"user_id": 1234,
"source_id": null,
"topic_ids": [
58,
59
],
"synapse_ids": [
2
],
"mapping_ids": [
94,
95,
96
],
"collaborator_ids": [],
"contributor_ids": [
2
]
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
get /maps/{id}
URI Parameters
- id: required (string)
Query Parameters
- embed: (string)
Comma-separated list of columns to embed. Each embedded column will be returned instead of the corresponding
field_id
orfield_ids
column. For instance,?embed=user
would remove theuser_id
integer field from a response and replace it with auser
object field.Possible embeddable fields are:
user,source,topics,synapses,mappings,contributors,collaborators
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": {
"id": 2,
"name": "Emergent Network Phenomena",
"desc": "Example map for the API",
"permission": "commons",
"screenshot": "https://s3.amazonaws.com/metamaps-assets/site/missing-map.png",
"starred": false,
"created_at": "2016-03-26T08:02:05.379Z",
"updated_at": "2016-03-27T07:20:18.047Z",
"user_id": 1234,
"source_id": null,
"topic_ids": [
58,
59
],
"synapse_ids": [
2
],
"mapping_ids": [
94,
95,
96
],
"collaborator_ids": [],
"contributor_ids": [
2
]
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
put /maps/{id}
URI Parameters
- id: required (string)
Body
Type: application/json
Properties- name: (string)
name
- desc: (string)
description
- permission: (string)
commons, public, or private
- screenshot: (string)
url to a screenshot of the map
- source_id: (string)
the id of the map this map is a fork of
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": {
"id": 2,
"name": "Emergent Network Phenomena",
"desc": "Example map for the API",
"permission": "commons",
"screenshot": "https://s3.amazonaws.com/metamaps-assets/site/missing-map.png",
"starred": false,
"created_at": "2016-03-26T08:02:05.379Z",
"updated_at": "2016-03-27T07:20:18.047Z",
"user_id": 1234,
"source_id": null,
"topic_ids": [
58,
59
],
"synapse_ids": [
2
],
"mapping_ids": [
94,
95,
96
],
"collaborator_ids": [],
"contributor_ids": [
2
]
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
patch /maps/{id}
URI Parameters
- id: required (string)
Body
Type: application/json
Properties- name: (string)
name
- desc: (string)
description
- permission: (string)
commons, public, or private
- screenshot: (string)
url to a screenshot of the map
- source_id: (string)
the id of the map this map is a fork of
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": {
"id": 2,
"name": "Emergent Network Phenomena",
"desc": "Example map for the API",
"permission": "commons",
"screenshot": "https://s3.amazonaws.com/metamaps-assets/site/missing-map.png",
"starred": false,
"created_at": "2016-03-26T08:02:05.379Z",
"updated_at": "2016-03-27T07:20:18.047Z",
"user_id": 1234,
"source_id": null,
"topic_ids": [
58,
59
],
"synapse_ids": [
2
],
"mapping_ids": [
94,
95,
96
],
"collaborator_ids": [],
"contributor_ids": [
2
]
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
delete /maps/{id}
URI Parameters
- id: required (string)
HTTP status code 204
No content
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
post /maps/{id}/stars
URI Parameters
- id: required (string)
HTTP status code 201
Created
Body
Type: application/json
Examples:
{
"data": {
"id": 2,
"name": "Emergent Network Phenomena",
"desc": "Example map for the API",
"permission": "commons",
"screenshot": "https://s3.amazonaws.com/metamaps-assets/site/missing-map.png",
"starred": true,
"created_at": "2016-03-26T08:02:05.379Z",
"updated_at": "2016-03-27T07:20:18.047Z",
"user_id": 1234,
"source_id": null,
"topic_ids": [
58,
59
],
"synapse_ids": [
2
],
"mapping_ids": [
94,
95,
96
],
"collaborator_ids": [],
"contributor_ids": [
2
]
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
delete /maps/{id}/stars
URI Parameters
- id: required (string)
HTTP status code 204
No content
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
/mappings
get /mappings
Query Parameters
- embed: (string)
Comma-separated list of columns to embed. Each embedded column will be returned instead of the corresponding
field_id
orfield_ids
column. For instance,?embed=user
would remove theuser_id
integer field from a response and replace it with auser
object field.Possible embeddable fields are:
user,updated_by,map
- sort: (string)
The name of the comma-separated fields to sort by, prefixed by "-" to sort descending
- page: (integer - default: 1)
The page number
- per: (integer - default: 25)
Number of records per page
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": [
{
"created_at": "2016-03-25T08:44:07.152Z",
"id": 1,
"map_id": 1,
"mappable_id": 1,
"mappable_type": "Topic",
"updated_at": "2016-03-25T08:44:07.152Z",
"user_id": 1,
"updated_by_id": 1,
"xloc": -271,
"yloc": 22
},
{
"created_at": "2016-03-25T08:44:13.907Z",
"id": 2,
"map_id": 1,
"mappable_id": 2,
"mappable_type": "Topic",
"updated_at": "2016-03-25T08:44:13.907Z",
"user_id": 1,
"updated_by_id": 1,
"xloc": -12,
"yloc": 61
},
{
"created_at": "2016-03-25T08:44:19.333Z",
"id": 3,
"map_id": 1,
"mappable_id": 3,
"mappable_type": "Topic",
"updated_at": "2016-03-25T08:44:19.333Z",
"user_id": 1,
"updated_by_id": 1,
"xloc": -93,
"yloc": -90
},
{
"created_at": "2016-03-25T08:44:21.337Z",
"id": 4,
"map_id": 1,
"mappable_id": 1,
"mappable_type": "Synapse",
"updated_at": "2016-03-25T08:44:21.337Z",
"user_id": 1,
"updated_by_id": 1
}
],
"page": {
"current_page": 1,
"next_page": 2,
"per": 4,
"prev_page": 0,
"total_count": 303,
"total_pages": 76
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
post /mappings
Body
Type: application/json
Properties- mappable_id: required (string)
id of the topic/synapse to be mapped
- mappable_type: required (string)
Topic or Synapse
- map_id: required (string)
id of the map
- xloc: (string)
(only for Topic mappings) x location on the canvas
- yloc: (string)
(only for Topic mappings) y location on the canvas
HTTP status code 201
Body
Type: application/json
Examples:
{
"data": {
"id": 4,
"created_at": "2016-03-25T08:44:21.337Z",
"updated_at": "2016-03-25T08:44:21.337Z",
"mappable_id": 1,
"mappable_type": "Synapse",
"user_id": 1,
"updated_by_id": 1,
"map_id": 1
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
get /mappings/{id}
URI Parameters
- id: required (string)
Query Parameters
- embed: (string)
Comma-separated list of columns to embed. Each embedded column will be returned instead of the corresponding
field_id
orfield_ids
column. For instance,?embed=user
would remove theuser_id
integer field from a response and replace it with auser
object field.Possible embeddable fields are:
user,updated_by,map
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": {
"id": 4,
"created_at": "2016-03-25T08:44:21.337Z",
"updated_at": "2016-03-25T08:44:21.337Z",
"mappable_id": 1,
"mappable_type": "Synapse",
"user_id": 1,
"updated_by_id": 1,
"map_id": 1
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
put /mappings/{id}
URI Parameters
- id: required (string)
Body
Type: application/json
Properties- mappable_id: (string)
id of the topic/synapse to be mapped
- mappable_type: (string)
Topic or Synapse
- map_id: (string)
id of the map
- xloc: (string)
(only for Topic mappings) x location on the canvas
- yloc: (string)
(only for Topic mappings) y location on the canvas
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": {
"id": 4,
"created_at": "2016-03-25T08:44:21.337Z",
"updated_at": "2016-03-25T08:44:21.337Z",
"mappable_id": 1,
"mappable_type": "Synapse",
"user_id": 1,
"updated_by_id": 1,
"map_id": 1
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
patch /mappings/{id}
URI Parameters
- id: required (string)
Body
Type: application/json
Properties- mappable_id: (string)
id of the topic/synapse to be mapped
- mappable_type: (string)
Topic or Synapse
- map_id: (string)
id of the map
- xloc: (string)
(only for Topic mappings) x location on the canvas
- yloc: (string)
(only for Topic mappings) y location on the canvas
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": {
"id": 4,
"created_at": "2016-03-25T08:44:21.337Z",
"updated_at": "2016-03-25T08:44:21.337Z",
"mappable_id": 1,
"mappable_type": "Synapse",
"user_id": 1,
"updated_by_id": 1,
"map_id": 1
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
delete /mappings/{id}
URI Parameters
- id: required (string)
HTTP status code 204
No content
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
/metacodes
get /metacodes
Query Parameters
- q: (string)
Search text columns for this string. A query of
"example"
will be passed to SQL asLIKE %example%
. The searchable columns are:name
- searchfields: (string)
A comma-seperated list of columns to search. For instance, to search a topic's name and description (but not link field) for the string "cognition", you could use
?q=cognition&searchfields=name,desc
. - sort: (string)
The name of the comma-separated fields to sort by, prefixed by "-" to sort descending
- page: (integer - default: 1)
The page number
- per: (integer - default: 25)
Number of records per page
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": [
{
"id": 1,
"name": "Action",
"color": "#BD6C85",
"icon": "https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_action.png"
},
{
"id": 2,
"name": "Activity",
"color": "#6EBF65",
"icon": "https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_activity.png"
},
{
"id": 3,
"name": "Catalyst",
"color": "#EF8964",
"icon": "https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_catalyst.png"
}
],
"page": {
"current_page": 1,
"next_page": 2,
"prev_page": 0,
"total_pages": 16,
"total_count": 47,
"per": 3
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
get /metacodes/{id}
URI Parameters
- id: required (string)
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": {
"id": 1,
"name": "Action",
"color": "#BD6C85",
"icon": "https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_action.png"
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
/synapses
get /synapses
Query Parameters
- q: (string)
Search text columns for this string. A query of
"example"
will be passed to SQL asLIKE %example%
. The searchable columns are:desc
- searchfields: (string)
A comma-seperated list of columns to search. For instance, to search a topic's name and description (but not link field) for the string "cognition", you could use
?q=cognition&searchfields=name,desc
. - embed: (string)
Comma-separated list of columns to embed. Each embedded column will be returned instead of the corresponding
field_id
orfield_ids
column. For instance,?embed=user
would remove theuser_id
integer field from a response and replace it with auser
object field.Possible embeddable fields are:
topic1,topic2,user
- sort: (string)
The name of the comma-separated fields to sort by, prefixed by "-" to sort descending
- page: (integer - default: 1)
The page number
- per: (integer - default: 25)
Number of records per page
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": [
{
"id": 2,
"desc": "hello",
"category": "from-to",
"permission": "commons",
"created_at": "2016-03-26T08:02:17.994Z",
"updated_at": "2016-03-26T08:02:17.994Z",
"topic1_id": 1,
"topic2_id": 2,
"user_id": 2
},
{
"id": 6,
"desc": "nice",
"category": "both",
"permission": "public",
"created_at": "2016-03-26T08:05:31.563Z",
"updated_at": "2016-03-26T08:05:31.563Z",
"topic1_id": 2,
"topic2_id": 3,
"user_id": 2
}
],
"page": {
"current_page": 1,
"next_page": 2,
"prev_page": 0,
"total_pages": 71,
"total_count": 142,
"per": 2
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
post /synapses
Body
Type: application/json
Properties- desc: (string)
text description of this synapse
- category: required (string)
from-to
orboth
- permission: required (string)
commons, public, or private
- topic1_id: required (string)
the topic being linked from
- topic2_id: required (string)
the topic being linked to
- user_id: required (string)
the creator of the topic
HTTP status code 201
Body
Type: application/json
Examples:
{
"data": {
"id": 2,
"desc": "hello",
"category": "from-to",
"permission": "commons",
"created_at": "2016-03-26T08:02:17.994Z",
"updated_at": "2016-03-26T08:02:17.994Z",
"topic1_id": 5,
"topic2_id": 6,
"user_id": 2
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
get /synapses/{id}
URI Parameters
- id: required (string)
Query Parameters
- embed: (string)
Comma-separated list of columns to embed. Each embedded column will be returned instead of the corresponding
field_id
orfield_ids
column. For instance,?embed=user
would remove theuser_id
integer field from a response and replace it with auser
object field.Possible embeddable fields are:
topic1,topic2,user
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": {
"id": 2,
"desc": "hello",
"category": "from-to",
"permission": "commons",
"created_at": "2016-03-26T08:02:17.994Z",
"updated_at": "2016-03-26T08:02:17.994Z",
"topic1_id": 5,
"topic2_id": 6,
"user_id": 2
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
put /synapses/{id}
URI Parameters
- id: required (string)
Body
Type: application/json
Properties- desc: (string)
text description of this synapse
- category: (string)
from-to
orboth
- permission: (string)
commons, public, or private
- topic1_id: (string)
the topic being linked from
- topic2_id: (string)
the topic being linked to
- user_id: (string)
the creator of the topic
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": {
"id": 2,
"desc": "hello",
"category": "from-to",
"permission": "commons",
"created_at": "2016-03-26T08:02:17.994Z",
"updated_at": "2016-03-26T08:02:17.994Z",
"topic1_id": 5,
"topic2_id": 6,
"user_id": 2
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
patch /synapses/{id}
URI Parameters
- id: required (string)
Body
Type: application/json
Properties- desc: (string)
text description of this synapse
- category: (string)
from-to
orboth
- permission: (string)
commons, public, or private
- topic1_id: (string)
the topic being linked from
- topic2_id: (string)
the topic being linked to
- user_id: (string)
the creator of the topic
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": {
"id": 2,
"desc": "hello",
"category": "from-to",
"permission": "commons",
"created_at": "2016-03-26T08:02:17.994Z",
"updated_at": "2016-03-26T08:02:17.994Z",
"topic1_id": 5,
"topic2_id": 6,
"user_id": 2
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
delete /synapses/{id}
URI Parameters
- id: required (string)
HTTP status code 204
No content
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
/tokens
A list of the current user's tokens.
get /tokens
A list of the current user's tokens.
Query Parameters
- q: (string)
Search text columns for this string. A query of
"example"
will be passed to SQL asLIKE %example%
. The searchable columns are:description
- searchfields: (string)
A comma-seperated list of columns to search. For instance, to search a topic's name and description (but not link field) for the string "cognition", you could use
?q=cognition&searchfields=name,desc
. - page: (integer - default: 1)
The page number
- per: (integer - default: 25)
Number of records per page
- sort: (string)
The name of the comma-separated fields to sort by, prefixed by "-" to sort descending
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": [
{
"id": 1,
"token": "VeI0qAe2bf2ytnrTRxmywsH0VSwuyjK5",
"description": "Personal token for in-browser testing",
"created_at": "2016-09-06T03:47:56.553Z"
}
],
"page": {
"current_page": 1,
"next_page": 0,
"prev_page": 0,
"total_pages": 1,
"total_count": 1,
"per": 25
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
post /tokens
Body
Type: application/json
Properties- description: (string)
short string describing this token
HTTP status code 201
Body
Type: application/json
Examples:
{
"data": {
"id": 1,
"token": "VeI0qAe2bf2ytnrTRxmywsH0VSwuyjK5",
"description": "Personal token for in-browser testing",
"created_at": "2016-09-06T03:47:56.553Z"
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
delete /tokens/{id}
URI Parameters
- id: required (string)
HTTP status code 204
No content
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
/topics
get /topics
Query Parameters
- q: (string)
Search text columns for this string. A query of
"example"
will be passed to SQL asLIKE %example%
. The searchable columns are:name, desc, link
- searchfields: (string)
A comma-seperated list of columns to search. For instance, to search a topic's name and description (but not link field) for the string "cognition", you could use
?q=cognition&searchfields=name,desc
. - embed: (string)
Comma-separated list of columns to embed. Each embedded column will be returned instead of the corresponding
field_id
orfield_ids
column. For instance,?embed=user
would remove theuser_id
integer field from a response and replace it with auser
object field.Possible embeddable fields are:
user,metacode
- sort: (string)
The name of the comma-separated fields to sort by, prefixed by "-" to sort descending
- page: (integer - default: 1)
The page number
- per: (integer - default: 25)
Number of records per page
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": [
{
"id": 670,
"name": "Metamaps.cc Website",
"desc": "Metamaps is a great website; check it out below!",
"link": "https://metamaps.cc",
"permission": "commons",
"created_at": "2016-07-02T09:23:30.397Z",
"updated_at": "2016-07-02T09:23:30.397Z",
"user_id": 2,
"metacode_id": 36
},
{
"id": 60,
"name": "View others on map in realtime",
"desc": "",
"link": "",
"permission": "commons",
"created_at": "2016-03-31T01:20:26.734Z",
"updated_at": "2016-03-31T01:20:26.734Z",
"user_id": 2,
"metacode_id": 8
}
],
"page": {
"current_page": 1,
"next_page": 2,
"prev_page": 0,
"total_pages": 249,
"total_count": 497,
"per": 2
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
post /topics
Body
Type: application/json
Properties- name: required (string)
Topic name; this will be visible on the map
- desc: required (string)
Longer topic description visible when opening a map card
- link: (string)
embed a link to content on the web in the topic card
- permission: required (string)
commons, public, or private
- metacode_id: required (string)
Topic's metacode
HTTP status code 201
Body
Type: application/json
Examples:
{
"data": {
"id": 670,
"name": "Metamaps.cc Website",
"desc": "Metamaps is a great website; check it out below!",
"link": "https://metamaps.cc",
"permission": "commons",
"created_at": "2016-07-02T09:23:30.397Z",
"updated_at": "2016-07-02T09:23:30.397Z",
"user_id": 2,
"metacode_id": 36
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
get /topics/{id}
URI Parameters
- id: required (string)
Query Parameters
- embed: (string)
Comma-separated list of columns to embed. Each embedded column will be returned instead of the corresponding
field_id
orfield_ids
column. For instance,?embed=user
would remove theuser_id
integer field from a response and replace it with auser
object field.Possible embeddable fields are:
user,metacode
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": {
"id": 670,
"name": "Metamaps.cc Website",
"desc": "Metamaps is a great website; check it out below!",
"link": "https://metamaps.cc",
"permission": "commons",
"created_at": "2016-07-02T09:23:30.397Z",
"updated_at": "2016-07-02T09:23:30.397Z",
"user_id": 2,
"metacode_id": 36
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
put /topics/{id}
URI Parameters
- id: required (string)
Body
Type: application/json
Properties- name: (string)
Topic name; this will be visible on the map
- desc: (string)
Longer topic description visible when opening a map card
- link: (string)
embed a link to content on the web in the topic card
- permission: (string)
commons, public, or private
- metacode_id: (string)
Topic's metacode
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": {
"id": 670,
"name": "Metamaps.cc Website",
"desc": "Metamaps is a great website; check it out below!",
"link": "https://metamaps.cc",
"permission": "commons",
"created_at": "2016-07-02T09:23:30.397Z",
"updated_at": "2016-07-02T09:23:30.397Z",
"user_id": 2,
"metacode_id": 36
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
patch /topics/{id}
URI Parameters
- id: required (string)
Body
Type: application/json
Properties- name: (string)
Topic name; this will be visible on the map
- desc: (string)
Longer topic description visible when opening a map card
- link: (string)
embed a link to content on the web in the topic card
- permission: (string)
commons, public, or private
- metacode_id: (string)
Topic's metacode
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": {
"id": 670,
"name": "Metamaps.cc Website",
"desc": "Metamaps is a great website; check it out below!",
"link": "https://metamaps.cc",
"permission": "commons",
"created_at": "2016-07-02T09:23:30.397Z",
"updated_at": "2016-07-02T09:23:30.397Z",
"user_id": 2,
"metacode_id": 36
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
delete /topics/{id}
URI Parameters
- id: required (string)
HTTP status code 204
No content
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
/users
get /users
Query Parameters
- q: (string)
Search text columns for this string. A query of
"example"
will be passed to SQL asLIKE %example%
. The searchable columns are:name
- searchfields: (string)
A comma-seperated list of columns to search. For instance, to search a topic's name and description (but not link field) for the string "cognition", you could use
?q=cognition&searchfields=name,desc
. - sort: (string)
The name of the comma-separated fields to sort by, prefixed by "-" to sort descending
- page: (integer - default: 1)
The page number
- per: (integer - default: 25)
Number of records per page
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": [
{
"id": 1,
"name": "user",
"avatar": "https://s3.amazonaws.com/metamaps-assets/site/user.png",
"generation": 0
},
{
"id": 2,
"name": "admin",
"avatar": "https://s3.amazonaws.com/metamaps-assets/site/user.png",
"generation": 0
}
],
"page": {
"current_page": 1,
"next_page": 0,
"prev_page": 0,
"total_pages": 1,
"total_count": 2,
"per": 25
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
get /users/{id}
URI Parameters
- id: required (string)
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": {
"id": 1,
"name": "user",
"avatar": "https://s3.amazonaws.com/metamaps-assets/site/user.png",
"generation": 0
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
get /users/current
HTTP status code 200
Body
Type: application/json
Examples:
{
"data": {
"id": 1,
"name": "user",
"avatar": "https://s3.amazonaws.com/metamaps-assets/site/user.png",
"generation": 0,
"is_admin": false,
"email": "user@example.com"
}
}
You can create a token by using the API, or you can get your first token at https://metamaps.cc/tokens/new. Once you have this token, you can append it to a request. For example, opening a private window in your browser and browsing to https://metamaps.cc/api/v2/users/current?token=...token here...
would show you your current user, even without logging in by another means.
To get a list of your current tokens (while logged in to the main site), you can run the following fetch request in your browser console (assuming the current tab is on some page within the metamaps.cc
website. The token you need to append to the url will look something like T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC
, but this example token won't work for you. You need your own.
fetch('/api/v2/tokens', {
method: 'GET',
credentials: 'same-origin', // needed so the API knows which account you're logged in to
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
If this is your first time accessing the API, this list wil be empty. You can create a token over the API using a similar method:
fetch('/api/v2/tokens?token=T1ZI012rseqF1XZWFBVj4JSXR5g3OpYC', {
method: 'POST'
}).then(response => {
return response.json()
}).then(payload => {
console.log(payload)
}).catch(console.error)
payload.data.token
will contain a string which you can use to append to requests to access the API from anywhere.
We use a flow for Oauth 2 authentication called Authorization Code. It basically consists of an exchange of an authorization
token for an access token
. For more detailed info, check out the RFC spec here
The first step is to register your client app.
Registering the client
Set up a new client in /oauth/applications/new
. For testing purposes, you should fill in the redirect URI field with urn:ietf:wg:oauth:2.0:oob
. This will tell it to display the authorization code instead of redirecting to a client application (that you don't have now).
Requesting authorization
To request the authorization token, you should visit the /oauth/authorize
endpoint. You can do that either by clicking in the link to the authorization page in the app details or by visiting manually the URL:
http://metamaps.cc/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code
Once you are there, you should sign in and click on Authorize
. You will then see a response that contains your "authorization code", which you need to exchange for an access token.
Requesting the access token
To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. Here's an example with fetch
fetch('https://metamaps.cc/oauth/token?client_id=THE_ID&client_secret=THE_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob', {
method: 'POST',
credentials: 'same-origin'
}).then(response => {
return response.json()
}).then(console.log).catch(console.error)
# The response will be like
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}
You can now make requests to the API with the access token returned.
Getting Started
There are two ways to log in: token-based authentication, or OAuth 2. If you're testing the API or making simple scripts, token-based is the best. If you're developing an app and want users to be able to log into Metamaps inside your app, you'll be able to use the OAuth 2 mechanism. Check the security tab of any of the endpoints above for instructions on logging in.