I wrote an custom contact import script for our NGO. The old contact data only contains valid country / state abbreviation names. For example CH / ZH = Switzerland / Zürich.
When I now want to create a new address over the API I don't see a way to fill out the 'state_province_id' field.
I'm able to get the country id with this syntax:
$result = civicrm_api3('Country', 'getsingle', array(
'sequential' => 1,
'return' => "id",
'iso_code' => $row["V"],
));
if(isset($result["id"])){
$params["api.address.create"][0]["country_id"] = $result["id"];
}
But how can I do the same with the State/Province, since there is no entity I can choose in the API?