Hi Robert,
You'll want to make REST calls against your the GeocodeAddresses REST endpoint for the geocoding service. Here's some documentation about using the GeocodeAddresses REST endpoint: geocodeAddresses—ArcGIS REST API: World Geocoding Service | ArcGIS for Developers
If you plan to do your geocoding against the world service, you'll need to get a token first, and pass that token in with your request. The user credentials associated with this token will be billed for the results of batch geocoding. If you are using your own geocoding service that you have stood up, you won't be charged for the results, but if the service is secure, you'll still need to pass a token.
By default, the geocodeAddresses operation returns ALL of the output fields that the service has turned on. It will be your job in post-processing to keep the ones you want, and to forget about the rest.
You'll want to copy the format for passing records that's described in the geocodeAddresses REST documentation above. Once you have the correct dictionary format for your input records in a recordset variable, then, you'll want to make the actual request.
values = {
"addresses": json.dumps(recordset, ensure_ascii=False),
"f": "json"
"token": token
}
response = requests.post(geocoding_service_url, data=values)
json_response = response.json()
Once you get the output dictionary/JSON of the GeocodeAddresses call, you can filter and only add certain values to your output resultant feature class in Python. So, after you get your REST response, you'll want to do something like:
arcpy.management.CreateFeatureclass(some_gdb, name_of_feature_class, "POINT", spatial_reference=sr)
arcpy.management.AddFields(path_to_fc, list_of_fields)
cursor = arcpy.da.InsertCursor(path_to_fc, list_of_fields + ['SHAPE@XY'])
< loop over the results of your JSON response >
< skip over the attributes you don't want in your output and only add the attributes you want to save to your list_of_attributes >
cursor.insertRow(list_of_attributes)