twilio / twilio-ruby

A Ruby gem for communicating with the Twilio API and generating TwiML
MIT License
1.35k stars 462 forks source link

Conference participants: Method not allowed #580

Closed adamgotterer closed 2 years ago

adamgotterer commented 2 years ago

Issue Summary

Unable to get a list of conference participants

Code Snippet

conference = @client.conferences('CFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx').fetch
@participants = conference.participants

Exception/Log

Traceback (most recent call last):
        2: from call_irs.rb:10:in `<main>'
        1: from /Users/adamgotterer/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/twilio-ruby-5.61.1/lib/twilio-ruby/rest/api/v2010/account/conference.rb:231:in `fetch'
/Users/adamgotterer/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/twilio-ruby-5.61.1/lib/twilio-ruby/framework/rest/version.rb:73:in `fetch': [HTTP 405] 20004 : Unable to fetch record (Twilio::REST::RestError)
Method not allowed
https://www.twilio.com/docs/errors/20004

Technical details:

eshanholtz commented 2 years ago

@adamgotterer unfortunately I am unable to recreate your issue with similar code. I've pasted it below for reference:

account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

begin
  conference = @client.conferences("CFxxxx").fetch
  @participants = conference.participants
  @participants.each { |participant|
    puts participant.to_s
  }
rescue
  puts @client.http_client.last_request
end

My initial instinct was to suggest double checking the correctness of your conference sid, however when I changed my test sid to an invalid sid, my error message is slightly different. If you add puts @client.http_client.last_request after your call to @client.conferences().fetch, what is the HTTP method that gets printed in the output?

adamgotterer commented 2 years ago

I found another way to successfully get the data I was looking for. However, your initial instinct was correct that the sid was invalid.

I copy and pasted the code you shared and the exception is the same and this is the last_request:

(XXXXX,XXXXX) GET https://api.twilio.com/2010-04-01/Accounts/XXXXX/Conferences/CFf484ced72cbad29525ee4837cb59d012.json
-H "User-Agent": "twilio-ruby/5.61.1 (ruby/x86_64-darwin15 2.3.0-p0)"
-H "Accept-Charset": "utf-8"
-H "Accept": "application/json"
eshanholtz commented 2 years ago

Do you get the expected behavior when you use the correct sid?

Apologies, that conference sid was a known invalid sid (I meant to change to CFxxx.. for clarity) and, regardless, each sid is tried directly to your account sid, so a conference sid that works correctly for me would not work for you, and vice versa.

eshanholtz commented 2 years ago

Closing due to lack of customer response.