Skip to content

Latest commit

 

History

History
215 lines (148 loc) · 5.4 KB

InstallApi.md

File metadata and controls

215 lines (148 loc) · 5.4 KB

InstallApi

Method HTTP request Description
installCheckConfig POST /install/check_config Checks configuration
installConfigure POST /install/configure Applies the initial configuration.
installGetAddresses GET /install/get_addresses Gets the network interfaces information.

installCheckConfig

CheckConfigResponse installCheckConfig(checkConfigRequest)

Example

import { createConfiguration, ServerConfiguration, InstallApi, InstallApiInstallCheckConfigRequest  } from 'adguardhome';
import * as fs from 'fs';

const configuration = createConfiguration({
    baseServer: new ServerConfiguration("http://adguarghome-ip/control/"),
    authMethods: {
        basicAuth: {
            username: "user",
            password: "pass"
        }
    }
});
const apiInstance = new InstallApi(configuration);

let body:InstallApiInstallCheckConfigRequest = {
  // CheckConfigRequest | Configuration to be checked
  checkConfigRequest: {
    dns: {
      ip: "127.0.0.1",
      port: 53,
      autofix: false,
    },
    web: {
      ip: "127.0.0.1",
      port: 53,
      autofix: false,
    },
    setStaticIp: false,
  },
};

apiInstance.installCheckConfig(body).then((data:any) => {
  console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));

Parameters

Name Type Description Notes
checkConfigRequest CheckConfigRequest Configuration to be checked

Return type

CheckConfigResponse

Authorization

basicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK. -
400 Failed to parse JSON or cannot listen on the specified address. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

installConfigure

void installConfigure(initialConfiguration)

Example

import { createConfiguration, ServerConfiguration, InstallApi, InstallApiInstallCheckConfigRequest  } from 'adguardhome';
import * as fs from 'fs';

const configuration = createConfiguration({
    baseServer: new ServerConfiguration("http://adguarghome-ip/control/"),
    authMethods: {
        basicAuth: {
            username: "user",
            password: "pass"
        }
    }
});
const apiInstance = new InstallApi(configuration);

let body:InstallApiInstallConfigureRequest = {
  // InitialConfiguration | Initial configuration JSON
  initialConfiguration: {
    dns: {
      ip: "127.0.0.1",
      port: 53,
    },
    web: {
      ip: "127.0.0.1",
      port: 53,
    },
    username: "admin",
    password: "password",
  },
};

apiInstance.installConfigure(body).then((data:any) => {
  console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));

Parameters

Name Type Description Notes
initialConfiguration InitialConfiguration Initial configuration JSON

Return type

void

Authorization

basicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

HTTP response details

Status code Description Response headers
200 OK. -
400 Failed to parse initial configuration or cannot listen to the specified addresses. -
422 The specified password does not meet the strength requirements. -
500 Cannot start the DNS server -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

installGetAddresses

AddressesInfo installGetAddresses()

Example

import { createConfiguration, ServerConfiguration, InstallApi  } from 'adguardhome';
import * as fs from 'fs';

const configuration = createConfiguration({
    baseServer: new ServerConfiguration("http://adguarghome-ip/control/"),
    authMethods: {
        basicAuth: {
            username: "user",
            password: "pass"
        }
    }
});
const apiInstance = new InstallApi(configuration);

let body:any = {};

apiInstance.installGetAddresses(body).then((data:any) => {
  console.log('API called successfully. Returned data: ' + data);
}).catch((error:any) => console.error(error));

Parameters

This endpoint does not need any parameter.

Return type

AddressesInfo

Authorization

basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]