Proxy-seller
ProxyFree toolsContact sales
  • Documentation
  • PROXY-SELLER
    • Authorization
    • Actions with proxies
      • Retrieve active proxy
      • Export IPs in txt/csv/custom
      • IP replacement
      • Comment on IP
      • Extend proxies
      • Authorizations
        • List of authorizations
        • Create authorization
        • Change authorization
        • Delete authorization
    • Order actions
      • Complete information
      • Calculate the order
      • Place an order
    • Balance
    • Residential proxy
      • Get package information
      • Get all locations
      • Get existing IP list
      • Create list
      • Rename list
      • Change rotation settings
      • Delete list
      • Subaccounts (subusers)
        • Create subuser package
        • Update package
        • Get package information
        • Delete subuser's package
        • Retrieve existing IP lists
        • Create IP list
        • Rename created list
        • Change rotation
        • Delete list
        • Create a special list for API-TOOL
      • Session ID + TTL
        • Create a special list
        • Get all ISP codes
      • Cases (FAQ)
    • API - Changelog
    • SDK PHP
    • SDK NodeJS
    • SDK Phyton
    • SDK Java
    • SDK Golang
  • Mobile CRM
    • Get authorization key
    • Usage guides
      • How to Work with API Reference
      • Host Actions
        • All hosts info
        • List of host modems
        • Change host name
        • Reboot all modems
        • Export modems info
      • Modem Actions
        • Get all modems
        • Change modem IP
        • Set pause on modem
        • Set unpause on modem
        • Reboot modem
        • Change modem rotation
        • Limits on modem
        • Delete limits on modems
        • Delete modem
        • Send a report
      • Modem authorization (users)
        • Create authorization
        • Edit authorization
        • Modem authorizations
        • Authorization info
        • Limit authorization
        • Get limit authorization
        • Delete authorization
      • Modem action links
        • Direct links
        • Create domain
        • Approve domain
        • Edit domain
        • All client domain
        • Domain info
        • Delete domain
    • API Reference
      • Hosts
      • Modems
      • Modem authorization
      • Action links
      • Proxy limit
  • More guides
    • Youtube channel
    • Our blog
  • News, discounts
    • Reddit
    • Discord
    • Telegram
Powered by GitBook
On this page
  • Example:
  • Response
  1. Mobile CRM
  2. Usage guides

How to Work with API Reference

PreviousUsage guidesNextHost Actions

Last updated 7 months ago

In this section, we will explore examples of interaction and how to use parameters in APIs

All data used in this example are placeholders and meant for demonstration purposes only. When working with the API, always use your own valid data.

PATCH https://mobile.proxy-seller.com/api/v1/hosts/{hostId}/changeName

Take a closer look

PATCH - indicates the method used for the query

{hostId} - indicates the variable to be replaced with its valid value.

Example:

https://mobile.proxy-seller.com/api/v1/hosts/21vjv1224n45v7457mvcas/changeName

Queries can have different set and type of parameters see figure below

All mandatory parameters are marked with an asterisk (*)

Let's consider an example of use in several programming languages

curl -X PATCH \
  -H "Content-Type: application/json" \
  -H "Authorization: YOUR_API_KEY" \
  -d '{"name":"Host new name"}' \
  "https://mobile.proxy-seller.com/api/v1/hosts/ID_OF_SOME_HOST/changeName"
User
import fetch from 'node-fetch';

const apiKey = "YOUR_API_KEY";
const hostId = "ID_OF_SOME_HOST";

// add path parameter to request
const url = "https://mobile.proxy-seller.com/api/v1/hosts/" + hostId + "/changeName";
// also "query" parameters are added here 
// const urlWithQuery = url + "?someNameParameter=someValue"
const body = { 
 name: "Host new name",
 // write here your body params
};
const response = await fetch(url, {
  method: 'patch',
  // add headers parameters to request
  headers: {
    'Content-Type': 'application/json', // it is impotent to body parameters
    'Authorization': apiKey,
    // write here your other headers params
  },
  // add body parameters to request
  body: JSON.stringify(body)
});

console.log(await response.json()); 
try {
            String apiKey = "YOUR_API_KEY";
            String hostId = "ID_OF_SOME_HOST";
            String url = "https://mobile.proxy-seller.com/api/v1/hosts/" + hostId + "/changeName";
            // also "query" parameters are added here 
            // String urlWithQuery = url + "?someNameParameter=someValue"
            // Constructing the request body
            String body = "{\"name\": \"Host new name"}";

            // Creating URL object
            URL obj = new URL(url);

            // Creating HTTPURLConnection
            HttpURLConnection con = (HttpURLConnection) obj.openConnection();

            // Setting the request method
            con.setRequestMethod("PATCH");

            // Setting headers
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", apiKey);

            // Enabling the connection to send and receive data
            con.setDoOutput(true);

            // Writing the request body
            DataOutputStream wr = new DataOutputStream(con.getOutputStream());
            wr.writeBytes(body);
            wr.flush();
            wr.close();

            // Reading the response
            int responseCode = con.getResponseCode();
            BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer response = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                response.append(inputLine);
            }
            in.close();

            // Printing the response
            System.out.println(response.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }

Response examples by HTTP status code. A '200' indicates success, while '4XX' codes indicate errors.

Response

{
    "id": "21vjv1224n45v7457mvcas",
    "name": "Host new name",
    "number": "101"
}
AUTHORIZATION_FAILED,
IP_AUTHORIZATION_FAILED,
HOST_USER_ID_AND_AUTH_DOES_NOT_MATCH
INVALID_HOST_ID,
HOST_NOT_FOUND
example request parameters