internal exception postUrl API call in custom function

internal exception postUrl API call in custom function

Hello,

I have a custom function written that makes a PostUrl API call to Hubspot CRM to create deals.  It works for me in Postman, however I am getting an "internal exception" when I execute it.

Here is the function code:

  1. myMap=map();
  2. myMap.put("Content Type","application/json");
  3. params="{\"associations\": {\"associatedCompanyIds\": [\"" + input.aHScompanyId + "\"],\"associatedVids\": [\"" + ccHSid + "\"]},\"properties\": [{\"value\": \"" + input.pPotentialName + "\",\"name\": \"dealname\"},{\"value\": \"" + ppAmount + "\",\"name\": \"amount\"},{\"value\":\"newbusiness\",\"name\": \"dealtype\"},{\"value\":\"7\",\"name\": \"hubspot_owner_id\"}]}";
  4. resp = postUrl("https://api.hubapi.com/deals/v1/deal/?hapikey=xxxxx-xxxx-xxx-xxxx-xxxxxx",params,myMap);
  5. info resp;