ApiConfig provides methods and properties for configuring API parameters
Get or set the authentication method.
basicoauth| Name | Type | Description |
|---|---|---|
authMethod |
string | the authentication method |
import { ApiConfig } from 'josm/api'
ApiConfig.authMethod // -> the current authentication method
// set OAuth as authentication method
ApiConfig.authMethod = 'oauth'
Get the default server URL
| Name | Type | Description |
|---|---|---|
defaultServerUrl |
string | the default server URL |
import { ApiConfig } from 'josm/api'
ApiConfig.defaultServerUrl // -> the default server url
Get or set the API server URL.
getset| Name | Type | Description |
|---|---|---|
serverUrl |
string |
import { ApiConfig } from 'josm/api'
ApiConfig.serverUrl // -> the current server url
// set a new API url
ApiConfig.serverUrl = 'http://api06.dev.openstreetmap.org'
| Name | Type | Argument | Description |
|---|---|---|---|
authMethod |
string | the authentication method. Either basic or oauth |
|
options |
module:josm/api~SetOrGetCredentialOptions |
<optional> |
additional options |
import { ApiConfig } from 'josm/api'
// get username/password for the current OSM API server
const credentials = ApiConfig.getCredentials('basic')
{user: string, password: string}.
OAuth authentication credentials are either an instance of
OAuthToken or
an object {key: string, secret: string}.
| Name | Type | Argument | Description |
|---|---|---|---|
authMethod |
string | the authentication method. Either 'basic' or 'oauth'. | |
credentials |
module:josm/api~BasicAuthParameters | module:josm/api~OAuthParameters | OAuthToken | PasswordAuthentication | the credentials | |
options |
module:josm/api~SetOrGetCredentialOptions |
<optional> |
additional options |
import { ApiConfig } from 'josm/api'
// set the credentials
ApiConfig.setCredentials('basic', { user:'test', password:'my-password' })