How to create product attribute with select type by REST API Magento 2?

Create Product attribute with select (drop-down) option type by REST Web API Magento 2.
You can create a product select type attribute with the provided payload and basic operation.

Action: POST

Request URL: <HOST_URL>/rest/V1/products/attributes (https://magento.test/rest/V1/products/attributes)

Header: Authorization:Bearer <admin_user_token>

Payload:

{
    "attribute": {
        "extension_attributes": {
            "is_pagebuilder_enabled": false
        },
        "is_wysiwyg_enabled": false,
        "is_html_allowed_on_front": true,
        "used_for_sort_by": false,
        "is_filterable": true,
        "is_filterable_in_search": false,
        "is_used_in_grid": false,
        "is_visible_in_grid": false,
        "is_filterable_in_grid": false,
        "position": 0,
        "apply_to": [],
        "is_searchable": "0",
        "is_visible_in_advanced_search": "0",
        "is_comparable": "1",
        "is_used_for_promo_rules": "1",
        "is_visible_on_front": "1",
        "used_in_product_listing": "0",
        "is_visible": true,
        "scope": "global",
        "attribute_id": null,
        "attribute_code": "my_attribute",
        "frontend_input": "select",
        "entity_type_id": "4",
        "is_required": false,
        "options": [
            {
                "label": "Small",
                "value": "Small",
                "sort_order": 0,
                "is_default": true,
                "store_labels": [
                    {
                        "store_id": 0,
                        "label": "Small"
                    }
                ]
            },
            {
                "label": "Medium",
                "value": "Medium",
                "sort_order": 0,
                "is_default": false,
                "store_labels": [
                    {
                        "store_id": 0,
                        "label": "Medium"
                    }
                ]
            },
            {
                "label": "Long",
                "value": "Long",
                "sort_order": 0,
                "is_default": false,
                "store_labels": [
                    {
                        "store_id": 0,
                        "label": "Long"
                    }
                ]
            }
        ],
        "is_user_defined": true,
        "default_frontend_label": "Specific Size",
        "frontend_labels": [],
        "backend_type": "text",
        "backend_model": "Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\ArrayBackend",
        "default_value": "",
        "is_unique": "0",
        "validation_rules": []
    }
}

In the Payload, you can add multiple select options with store-related labels and basic info you want with the product attribute.

Here frontend_input type must be select and the attribute_code must be a unique attribute code. I have used the attriburte_code value as my_attribute.

Response: New Product Attribute Details.

{
    "extension_attributes": {
        "is_pagebuilder_enabled": false
    },
    "is_wysiwyg_enabled": false,
    "is_html_allowed_on_front": true,
    "used_for_sort_by": false,
    "is_filterable": true,
    "is_filterable_in_search": false,
    "is_used_in_grid": false,
    "is_visible_in_grid": false,
    "is_filterable_in_grid": false,
    "position": 0,
    "apply_to": [],
    "is_searchable": "0",
    "is_visible_in_advanced_search": "0",
    "is_comparable": "1",
    "is_used_for_promo_rules": "1",
    "is_visible_on_front": "1",
    "used_in_product_listing": "0",
    "is_visible": true,
    "scope": "global",
    "attribute_id": 345,
    "attribute_code": "my_attribute",
    "frontend_input": "select",
    "entity_type_id": "4",
    "is_required": false,
    "options": [
        {
            "label": " ",
            "value": ""
        },
        {
            "label": "Small",
            "value": "18170"
        },
        {
            "label": "Medium",
            "value": "18171"
        },
        {
            "label": "Long",
            "value": "18172"
        }
    ],
    "is_user_defined": true,
    "default_frontend_label": "Specific Size",
    "frontend_labels": [],
    "backend_type": "text",
    "backend_model": "Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\ArrayBackend",
    "default_value": "18170",
    "is_unique": "0",
    "validation_rules": []
}

You can create any type of product attribute with Magento 2 with the help of REST API.