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

Requests to bulk US verifications are invalid. #201

Closed
gdotdesign opened this issue Dec 15, 2021 · 6 comments
Closed

Requests to bulk US verifications are invalid. #201

gdotdesign opened this issue Dec 15, 2021 · 6 comments
Assignees

Comments

@gdotdesign
Copy link

I'm trying to make requests to the Bulk Verify endpoint https://docs.lob.com/#operation/bulk_us_verifications using this gem, but the requests end up wrong.

lob =
  Lob::Client.new(api_key: API_KEY)

addresses =
  [
    {
      'primary_line' => '323 Greenwich St Apt 5',
      'state' => 'NY',
      'city' => 'New York',
      'zip_code' => '10013'
    },
    {
     'primary_line' => '50 Riverside Blvd Apt 12B',
      'state' => 'NY',
      'city' => 'New York',
      'zip_code' => '10069'
    },
    {
      'primary_line' => '22 Christopher St',
      'state' => 'NY',
      'city' => 'New York',
      'zip_code' => '10014'
    },
    {
      'primary_line' => '45 West 67th Street Apt 33B',
      'state' => 'NY',
      'city' => 'New York',
      'zip_code' => '10023'
    }
  ]

response =
  lob.bulk_us_verifications.verify(addresses: addresses)

puts response # {"addresses"=>[{"error"=>{"message"=>"city must be a string", "status_code"=>422}}], "errors"=>true}

This is the request body that I see in the dashboard:

image

I'm guessing rest-client is at fault but couldn't debug it yet. If I'm doing something wrong let me know.

@ShariqT ShariqT self-assigned this Dec 15, 2021
@ShariqT
Copy link
Contributor

ShariqT commented Dec 16, 2021

Thanks for using Lob! You weren't doing anything wrong. There is an error in how we are sending the payload to the RestClient. The fix is in this PR.

@gdotdesign
Copy link
Author

gdotdesign commented Dec 17, 2021

FYI I'm still seeing the same error with 5.4.4. If it helps the rest-client version is 2.1.0.

@ShariqT
Copy link
Contributor

ShariqT commented Dec 17, 2021

I'm going to investigate this further. I thought the payload issue was fix.

@ShariqT
Copy link
Contributor

ShariqT commented Dec 30, 2021

So, it looks like you have to convert the array of addresses to JSON before passing it to the verify method.

response =
  lob.bulk_us_verifications.verify(addresses: addresses.to_json)

puts response

Screen Shot 2021-12-29 at 5 47 50 PM

This isn't exactly user-friendly, so we'll look into making a change to fix this so that you can just pass in the Ruby hashes instead of doing that conversion after the holidays. In the meantime, this solution won't block you from using the library.

Happy holidays!

@ShariqT ShariqT closed this as completed Dec 30, 2021
@gdotdesign
Copy link
Author

Thanks 🙏 I tried this before and wasn't successful, but probably the change in 5.4.4 allows for this now, will try it out.

@ShariqT
Copy link
Contributor

ShariqT commented Jan 25, 2022

@gdotdesign Yes, please try 5.4.5 or 5.4.6. The latter will allow you to pass in the array of hashes like you originally wanted.

@ShariqT ShariqT closed this as completed Jan 25, 2022
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

2 participants