how to save selected option in variable for rest api category filter

how to save selected option in variable for rest api category filter