APIs & Integrations

Non applicable

Can't create Company from Java

I sent json to https://api.hubapi.com/companies/v2/companies?hapikey=API_KEY, then I see to hubspot(dot)com/sales/3833222/companies/list/view/all/?, and there is no new companies.
Here is my code.
JSONObject company = new JSONObject();
JSONObject description = new JSONObject();
JSONArray properties = new JSONArray();
JSONObject data = new JSONObject();
company.put(“name”, “name”);
company.put(“value”, “A company name”);
description.put(“name”, “description”);
description.put(“value”, “A company description”);
properties.put(company);
properties.put(description);
data.put(“properties”, properties);
String request = “https://api.hubapi.com/companies/v2/companies?hapikey=” + API_KEY;
URL url = new URL(request);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setInstanceFollowRedirects(false);
conn.setRequestMethod(“POST”);
conn.setRequestProperty(“Content-Type”, “application/json; charset=UTF-8”);
conn.setUseCaches(false);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data.toString());

System.out.println(data.toString());
{"properties":[{"name":"name","value":"A company name"},{"name":"description","value":"A company description"}]}

What I do wrong?

0 Votes
1 Réponse
mclayton
Participant

Can't create Company from Java

same thing happened to me.

Dont confuse your developer org with your production org.
two different things.