Hey y’all…
I’m trying to read some field metadata, and getting a 403. I have a multi-select drop-down defined as a field on one of my collections. So, I’m trying to run the following query to get the metadata of what options the user can select.
I have turned Read access on for directus_fields and verified that all fields on that collection have read access. However, I get a 403 both in my code and when I ping the API directly.
Any ideas what I might be doing wrong?
Code:
try {
final response = await get(
'directus_fields',
query: {
'filter[collection][_eq]': 'SpiritualExercise',
'filter[field][_eq]': 'difficulty_level',
'fields': 'options.choices',
});
final data = response['data'];
… where get() is …
Future<Map<String, dynamic>> get(
String collection, {
String? id,
Map<String, dynamic>? query,
}) async {
try {
return await _authenticatedRequest((token) => dio.get(
id != null
? '$baseUrl/items/$collection/$id'
: '$baseUrl/items/$collection',
queryParameters: query,
options: Options(
headers: {'Authorization': 'Bearer $token'},
),
)).then((response) => response.data);
} catch (e) {
_logger.severe('Get error: $e');
rethrow;
}
}
And the API call is:
https:///items/directus_fields
Thank you in advance for your help!
-J