Skip to content

EnumDatePreset values being incorrectly serialzied to the URL parameters as upper case #466

@maxkremer

Description

@maxkremer

Which SDK version are you using?

20.0.0

What's the issue?

Date preset enums EnumDatePreset are being serialized to the graph API URLs parameters as upper case values. Producing a message 100 error

Steps/Sample code to reproduce the issue

      APINodeList<Ad> ads = account.getAds()
                .setParam("date_format", "U") //request dates as epochs
                .setParam("limit", 100) //page size
                .setDatePreset(Ad.EnumDatePreset.VALUE_LAST_90D)
                .requestFields(fields)
                .execute();

Observed Results:

When added to the URL the endpoint complains with the error

{
   "error": {
      "message": "(#100) date_preset must be one of the following values: today, yesterday, this_month, last_month, this_quarter, maximum, data_maximum, last_3d, last_7d, last_14d, last_28d, last_30d, last_90d, last_week_mon_sun, last_week_sun_sat, last_quarter, last_year, this_week_mon_today, this_week_sun_today, this_year",
      "type": "OAuthException",
      "code": 100,
      "fbtrace_id": "Af7UW8liBFkZ_n4YuiC-_KS"
   }
}

You can see from the URL that was built for the request the date_preset is uppercase - manually changing it to lower case produces the correct response from the endpoint

https://graph.facebook.com/v20.0/act_1289608875113430/adsets?limit=100&access_token=XXXXXXXX&date_format=U&appsecret_proof=XXXXXXXXXXX&fields=id%2Caccount_id%2Ccreated_time%2Cupdated_time%2Cend_time%2Ccampaign%2Cbudget_remaining%2Cdaily_budget%2Ceffective_status%2Cname&date_preset=LAST_90D

Expected Results:

I expect the enum values to be serialized to the url in lower case as in last_90d not LAST_90_D

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions