Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NumberLookupService incorrectly formatting URL for Type #79

Open
jaimefuhr opened this issue Jan 4, 2024 · 0 comments
Open

NumberLookupService incorrectly formatting URL for Type #79

jaimefuhr opened this issue Jan 4, 2024 · 0 comments

Comments

@jaimefuhr
Copy link

jaimefuhr commented Jan 4, 2024

The NumberLookupService never returns carrier or caller-name information despite providing the Type in NumberLookupRecordOptions.

The type is included in the URL as JSON instead of a name-value pair:

Invalid URL generated by Service.ApplyAllParameters method:

https://api.telnyx.com/v2/number_lookup/%2B18665552368?{"type":"carrier"}

Correct URL:

https://api.telnyx.com/v2/number_lookup/%2B18665552368?type=carrier

The invalid URL will return a 200 but NO carrier information. Likewise if type is set to caller-name, that data is null.

var number = "+118665552368";
var request = new RequestOptions();
request.ApiKey = APIKey;

var lookupOptions = new NumberLookupRecordOptions {
    Type = "carrier"
};

var lookup = new NumberLookupService();
var response = lookup.Get(number, lookupOptions, request);

Response:
{
  "data":{
    "country_code":"US",
    "national_format":"(866) 555-2368",
    "phone_number":"+18665552368",
    "fraud":null,
    "carrier":null,
    "caller_name":null,
    "nnid_override":null,
    "portability":{
      "lrn":null,
      "ported_status":"",
      "ported_date":"",
      "ocn":null,
      "line_type":"",
      "spid":"",
      "spid_carrier_name":null,
      "spid_carrier_type":"",
      "altspid":"",
      "altspid_carrier_name":"",
      "altspid_carrier_type":"",
      "city":"",
      "state":""
    },
    "valid_number":true,
    "record_type":"number_lookup"
  }
}

The workaround is to not set the Type property in NumberLookupRecordOptions and use the ExtraParams property:

options.ExtraParams.Add("type", "carrier");
//options.ExtraParams.Add("type","caller-name");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant