facebook / facebook-java-business-sdk

Java SDK for Meta Marketing APIs

Home Page:https://developers.facebook.com/docs/business-sdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Autocomplete search] - Unable to fetch the list of all possible country_group using SDK

gotham3 opened this issue · comments

Which SDK version are you using?

v14.0.0

What's the issue?

Unable to fetch the list of all possible country_group supported on Facebook, using the SDK. However the same API call is working when directly hitting the API through Postman.

Steps/Sample code to reproduce the issue

APIRequest<APINode> apiRequest = new APIRequest<>(context, "", "search", "GET");
Map<String, Object> params = new HashMap<>();
params.put("type", "adgeolocation");
params.put("location_types", List.of("country_group"));
APIResponse response = apiRequest.execute(params);

I even tried passing parameter 'q' as empty string "".

Observed Results:

  • What happened? This could be a description, log output, etc.
    Empty response was returned.

Expected Results:

  • What did you expect to happen?
    Ideally the list of all possible country_group should be returned.
    Please note that this exact API works when hitting through postman.
    Here's the cURL I used -
curl --location -g --request GET 'https://graph.facebook.com/v14.0/search?location_types=["country_group"]&type=adgeolocation&access_token=*******'

Expected response was returned when using the above cURL :
image

verified on the latest version that the output is as expected.