Exporting custom field values from Odoo into Woocommerce using the api or python requests module

I am trying to integrate Woocommerce and Odoo by sharing the data between them. For custom fields I could not find a way to import or export them using the api like for the tags or categories fields, so for the import I used the python requests module to get the data for that field.

requests.get('https://{company_name}.standout-digital.com/wp-json/wp/v2/{field_name}')

it worked as expected and I was allowed to get all the data I needed. For the export, I assumed I could do the same thing with a post request instead of a get request

requests.post('https://{company_name}.standout-digital.com/wp-json/wp/v2/{field_name}', {'name': '{name}'})

But I ended up getting a 401 error ‘Sorry, you are not allowed to create terms in this taxonomy.’ I tried including the authentication in the request with the consumer key and secret key but I get the same response.

I also tried writing some php code in Woocommerce using the Snippets plugin to make it so that the field would be writable but I don’t know much php and this is what I got. It also didn’t change anything even after activating the snippet.

function {function_name}() {
    $args = array(
        'label'            => '{label}',
        'rewrite'          => array( 'slug' => '{slug}' ),
        'hierarchical'     => true,
        'show_in_rest'     => true,
        'rest_base'        => '{base_name}',
        'show_ui'          => true,
        'show_in_menu'     => true,
    );
    register_taxonomy('{base_name}', 'product', $args);
}
add_action('init', '{function_name}');

Is there a workaround for this, or a PHP code I need to run, or alternatively a different way to do this entire thing?