I figured it out.
I needed to first make a custom module. Then create a plugin with a FieldType, FieldFormatter and and FieldWidget where the formGet method does an http request to populate the select options.