Skip to content

Instantly share code, notes, and snippets.

@vasilvix vasilvix/
Created May 15, 2019

What would you like to do?
Пример запроса на создание новой организации
package ru.prin;
import lombok.AllArgsConstructor;
class ChcApi {
private String apiUrl;
private String authToken;
private String authKey;
void addCompany(String companyName, String companyAddress, String shortName, String password,
String username, String contacts, String mobile, String mail, String telephone) {
String data = "CompanyID=-1"
+ "&CompanyName=" + companyName
+ "&CompanyAddress=" + companyAddress
+ "&ShortName=" + shortName
+ "&Password=" + password
+ "&UserName=" + username
+ "&Contacts=" + contacts
+ "&Mobile=" + mobile
+ "&Mail=" + mail
+ "&TelePhone=" + telephone;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.header("AuthToken", authToken)
.header("AuthKey", authKey)
.header("Content-Type", "application/x-www-form-urlencoded")
client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.