<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: I'm getting a 301 error whenever I try to purchase a number through a REST Client in Discussion Forum</title>
    <link>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12536#M306</link>
    <description>&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;For those who need help with the 301 error:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I had an extra / in the URL. Make sure that the URL is 100% matching.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;For those who are getting a similar "invalid character" 400 error with a rest client:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Try converting your&amp;nbsp;&lt;STRONG&gt;payload&lt;/STRONG&gt; into a JSON string. All that I had to do here, was make&amp;nbsp;&lt;STRONG&gt;payload = payload.to_json&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Sep 2023 02:06:10 GMT</pubDate>
    <dc:creator>joeytextline</dc:creator>
    <dc:date>2023-09-08T02:06:10Z</dc:date>
    <item>
      <title>I'm getting a 301 error whenever I try to purchase a number through a REST Client</title>
      <link>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12511#M294</link>
      <description>&lt;P class=""&gt;&lt;SPAN class=""&gt;For some reason, the exact same credentials, data and endpoint work fine when I do a CURL request:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;curl -i -X POST -u apikey:secret '&lt;A href="https://numbers.api.sinch.com/v1/projects/d958419f-d446-4bc7-82ad-f8ccc76b217f/availableNumbers:rentAny" target="_blank" rel="noopener"&gt;https://numbers.api.sinch.com/v1/projects/{project_id}/availableNumbers:rentAny&lt;/A&gt;' \ -H 'Content-Type: application/json' \ -d '{ "regionCode": "US", "type": "LOCAL", "numberPattern": { "pattern": "206", "searchPattern": "START" }, "smsConfiguration": { "servicePlanId": "service_plan_id" } }'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I use my Ruby console, and try to do this through a REST Client, I get the following error:&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;RestClient::MovedPermanently (&lt;/SPAN&gt;&lt;SPAN class=""&gt;301 Moved Permanently&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;What's a common reason for the 301 error?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 04:15:19 GMT</pubDate>
      <guid>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12511#M294</guid>
      <dc:creator>joeytextline</dc:creator>
      <dc:date>2023-09-07T04:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a 301 error whenever I try to purchase a number through a REST Client</title>
      <link>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12516#M295</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your ruby HTTP client you are not handling redirects by the sound of it, whereas curl is. Can you check how to handle redirects automatically with Ruby HTTP?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Roland-Ian&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 14:30:04 GMT</pubDate>
      <guid>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12516#M295</guid>
      <dc:creator>Roland_Ian</dc:creator>
      <dc:date>2023-09-05T14:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a 301 error whenever I try to purchase a number through a REST Client</title>
      <link>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12519#M298</link>
      <description>&lt;P&gt;Thank you for the response!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So basically, I'm using this standard gem&amp;nbsp;&lt;A href="https://rubygems.org/gems/rest-client/versions/1.6.9?locale=en" target="_blank" rel="noopener"&gt;https://rubygems.org/gems/rest-client/versions/1.6.9?locale=en&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since you commented, &lt;STRONG&gt;I realized that I had an extra "/" in the endpoint&lt;/STRONG&gt;. So to anyone stumbling on this thread, that's probably your answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But now I'm getting a "400 Bad Request" error, with the same exact variables that I'm putting into my CURL request.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I copied all of the parameters, and put them directly into my console:&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;gt; opts = {&lt;/SPAN&gt;&lt;SPAN class=""&gt;:method&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&amp;gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;:post&lt;/SPAN&gt;&lt;SPAN class=""&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;:payload&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&amp;gt;{&lt;/SPAN&gt;&lt;SPAN class=""&gt;:smsConfiguration&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&amp;gt;{&lt;/SPAN&gt;&lt;SPAN class=""&gt;:servicePlanId&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&amp;gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;"{service_plan_id}"&lt;/SPAN&gt;&lt;SPAN class=""&gt;}, &lt;/SPAN&gt;&lt;SPAN class=""&gt;:regionCode&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&amp;gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;"US"&lt;/SPAN&gt;&lt;SPAN class=""&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;:type&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&amp;gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;"LOCAL"&lt;/SPAN&gt;&lt;SPAN class=""&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;:numberPattern&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&amp;gt;{&lt;/SPAN&gt;&lt;SPAN class=""&gt;:pattern&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&amp;gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;"206"&lt;/SPAN&gt;&lt;SPAN class=""&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;:search&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Pattern&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&amp;gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;:START&lt;/SPAN&gt;&lt;SPAN class=""&gt;}}, &lt;/SPAN&gt;&lt;SPAN class=""&gt;:url&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&amp;gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;"&lt;A href="https://numbers.api.sinch.com/v1/projects/{project_id}/availableNumbers:rentAny" target="_blank" rel="noopener"&gt;https://numbers.api.sinch.com/v1/projects/{project_id}/availableNumbers:rentAny&lt;/A&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;:headers&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&amp;gt;{}, &lt;/SPAN&gt;&lt;SPAN class=""&gt;:user&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&amp;gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;"apikey"&lt;/SPAN&gt;&lt;SPAN class=""&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;:password&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&amp;gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;"secret"&lt;/SPAN&gt;&lt;SPAN class=""&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;According to their documentation, these opts should mimic the CURL request that I mentioned above. But when I put it into the console:&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt;RestClient&lt;/SPAN&gt;&lt;SPAN class=""&gt;::&lt;/SPAN&gt;&lt;SPAN class=""&gt;Request&lt;/SPAN&gt;&lt;SPAN class=""&gt;.execute(opts)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Traceback&lt;/SPAN&gt;&lt;SPAN class=""&gt; (most recent call last):&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;1: from (irb):37&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;RestClient::BadRequest (&lt;/SPAN&gt;&lt;SPAN class=""&gt;400 Bad Request&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;It's the same if I just request availableNumbers with the ":rentAny". I am very confused because it should work exactly the same vs using CURL.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 05:51:07 GMT</pubDate>
      <guid>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12519#M298</guid>
      <dc:creator>joeytextline</dc:creator>
      <dc:date>2023-09-07T05:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a 301 error whenever I try to purchase a number through a REST Client</title>
      <link>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12520#M299</link>
      <description>&lt;P&gt;Also, it doesn't give a detailed error message if I catch the exception:&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt;begin&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;gt; &lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;RestClient&lt;/SPAN&gt;&lt;SPAN class=""&gt;::&lt;/SPAN&gt;&lt;SPAN class=""&gt;Request&lt;/SPAN&gt;&lt;SPAN class=""&gt;.execute(opts)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt;rescue&lt;/SPAN&gt; &lt;SPAN class=""&gt;RestClient&lt;/SPAN&gt;&lt;SPAN class=""&gt;::&lt;/SPAN&gt;&lt;SPAN class=""&gt;BadRequest&lt;/SPAN&gt;&lt;SPAN class=""&gt; =&amp;gt; e&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;gt; &lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;puts &lt;/SPAN&gt;&lt;SPAN class=""&gt;"e"&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt;end&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;e&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;=&amp;gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt;nil&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;gt; e&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;=&amp;gt; #&amp;lt;RestClient::BadRequest: 400 Bad Request&amp;gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;gt; puts e&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;400 Bad Request&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;=&amp;gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt;nil&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;gt; e.default_message&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;=&amp;gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt;"400 Bad Request"&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;gt; e.message&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;=&amp;gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt;"400 Bad Request"&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;gt; e.original_exception&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;=&amp;gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt;nil&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;gt; e.to_s&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;=&amp;gt; &lt;/SPAN&gt;&lt;SPAN class=""&gt;"400 Bad Request"&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 07:20:06 GMT</pubDate>
      <guid>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12520#M299</guid>
      <dc:creator>joeytextline</dc:creator>
      <dc:date>2023-09-07T07:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a 301 error whenever I try to purchase a number through a REST Client</title>
      <link>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12521#M300</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Sorry I am actually able to get a clearer response if I type in&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;STRONG&gt;e.response.body&lt;/STRONG&gt;: &lt;EM&gt;"&lt;/EM&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN class=""&gt;invalid character 's' looking for beginning of value"&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;From what I've look into, it means that Sinch is not returning a valid response.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 06:22:30 GMT</pubDate>
      <guid>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12521#M300</guid>
      <dc:creator>joeytextline</dc:creator>
      <dc:date>2023-09-07T06:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a 301 error whenever I try to purchase a number through a REST Client</title>
      <link>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12522#M301</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;For whatever reason your payload is not valid. I would suspect the json payload is not properly formatted or you have some extra character included.&lt;/P&gt;
&lt;P&gt;I recommend to intercept the outgoing HTTP request so you can validate the payload.&amp;nbsp; You should be able to output the HTTP headers and request, then check the JSON payload is valid with jq.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 07:18:49 GMT</pubDate>
      <guid>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12522#M301</guid>
      <dc:creator>Roland_Ian</dc:creator>
      <dc:date>2023-09-07T07:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a 301 error whenever I try to purchase a number through a REST Client</title>
      <link>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12523#M302</link>
      <description>&lt;P&gt;Thank you for the response again, Roland!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just copy/pasted every single key, value the apikey, secret, and endpoint from the failed Ruby rest-client request, into a curl request.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With all of the same exact data, it works on a CURL request, but not when using the rest-client on Ruby.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe it has to do with the ":" colon? Because I actually just got the &lt;STRONG&gt;availableNumbers&lt;/STRONG&gt; endpoint to work with the Ruby rest-client, but&amp;nbsp;&lt;STRONG&gt;availableNumber:rentAny&lt;/STRONG&gt; and&amp;nbsp;&lt;STRONG&gt;availableNumber:rent&lt;/STRONG&gt; aren't working. It seems that Ruby's rest client really just doesn't like something about these parameters, and I can't think of what else.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regardless,&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;"&lt;/EM&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN class=""&gt;invalid character 's' looking for beginning of value"&lt;/SPAN&gt;&lt;/EM&gt; means that their response is not in a valid JSON format. From what I googled anyways.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 11:05:58 GMT</pubDate>
      <guid>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12523#M302</guid>
      <dc:creator>joeytextline</dc:creator>
      <dc:date>2023-09-07T11:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a 301 error whenever I try to purchase a number through a REST Client</title>
      <link>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12528#M303</link>
      <description>&lt;P&gt;seriously, if I change the URL from:&lt;/P&gt;&lt;P&gt;"&lt;A href="https://numbers.api.sinch.com/v1/projects/%7Bproject_id%7D/availableNumbers:rentAny" target="_blank" rel="noopener noreferrer"&gt;https://numbers.api.sinch.com/v1/projects/{project_id}/availableNumbers:rentAny&lt;/A&gt;" to just "&lt;A href="https://numbers.api.sinch.com/v1/projects/%7Bproject_id%7D/availableNumbers:rentAny" target="_blank" rel="noopener noreferrer"&gt;https://numbers.api.sinch.com/v1/projects/{project_id}/availableNumbers?regionCode=US%type=LOCAL&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;and the method from&amp;nbsp;:post to :get&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then run&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;RestClient&lt;/SPAN&gt;&lt;SPAN class=""&gt;::&lt;/SPAN&gt;&lt;SPAN class=""&gt;Request&lt;/SPAN&gt;&lt;SPAN class=""&gt;.execute(opts)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;it works.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;it's just not accepting when I change it to availableNumbers&lt;STRONG&gt;:rentAny&lt;/STRONG&gt;. I've also tried to encode it as availableNumbers&lt;STRONG&gt;%3ArentAny&lt;/STRONG&gt;, and that also did not work.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 11:42:34 GMT</pubDate>
      <guid>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12528#M303</guid>
      <dc:creator>joeytextline</dc:creator>
      <dc:date>2023-09-07T11:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a 301 error whenever I try to purchase a number through a REST Client</title>
      <link>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12534#M304</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;GET and POST are quite different in the fact that GET does not deliver a payload, it just retrieves data,&amp;nbsp; but POST delivers a payload for parsing.&lt;/P&gt;
&lt;P&gt;Please can you verify that the payload you send is well formatted json?&amp;nbsp; I would recommend to open a ticket with SINCH support so they can look at the incoming payload for you if you are unable to do it&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 12:20:02 GMT</pubDate>
      <guid>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12534#M304</guid>
      <dc:creator>Roland_Ian</dc:creator>
      <dc:date>2023-09-07T12:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a 301 error whenever I try to purchase a number through a REST Client</title>
      <link>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12535#M305</link>
      <description>&lt;P&gt;Hey Roland, thank you for the reply again! Yeah I know the difference between GET and POST&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; I am a software developer lol.. The difference that I was pointing out, is that your GET availableNumbers was working fine, but you POST availableNumber&lt;STRONG&gt;:rentAny&lt;/STRONG&gt;&amp;nbsp;(which is a separate endpoint) was not working fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyways, I solved it! The payload needs to be JSONified. The rest client sends it as an object (vs CURL will send it as a JSON string) and the API only accepts the JSON string.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll write a detailed version in a minute, and I'll make that the answer here.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2023 02:02:22 GMT</pubDate>
      <guid>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12535#M305</guid>
      <dc:creator>joeytextline</dc:creator>
      <dc:date>2023-09-08T02:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a 301 error whenever I try to purchase a number through a REST Client</title>
      <link>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12536#M306</link>
      <description>&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;For those who need help with the 301 error:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I had an extra / in the URL. Make sure that the URL is 100% matching.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;For those who are getting a similar "invalid character" 400 error with a rest client:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Try converting your&amp;nbsp;&lt;STRONG&gt;payload&lt;/STRONG&gt; into a JSON string. All that I had to do here, was make&amp;nbsp;&lt;STRONG&gt;payload = payload.to_json&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2023 02:06:10 GMT</pubDate>
      <guid>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12536#M306</guid>
      <dc:creator>joeytextline</dc:creator>
      <dc:date>2023-09-08T02:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a 301 error whenever I try to purchase a number through a REST Client</title>
      <link>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12537#M307</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes sorry, I never meant to doubt your ability.&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do it as this might be helpful to others who find this post, they might be just beginning with the concepts.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2023 06:47:44 GMT</pubDate>
      <guid>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12537#M307</guid>
      <dc:creator>Roland_Ian</dc:creator>
      <dc:date>2023-09-08T06:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a 301 error whenever I try to purchase a number through a REST Client</title>
      <link>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12538#M308</link>
      <description>&lt;P&gt;Glad to see you solved it!&amp;nbsp; JSON can be fiddly for sure, so ensure its valid is always a good approach.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2023 06:48:38 GMT</pubDate>
      <guid>https://community.sinch.com/t5/Discussion-Forum/I-m-getting-a-301-error-whenever-I-try-to-purchase-a-number/m-p/12538#M308</guid>
      <dc:creator>Roland_Ian</dc:creator>
      <dc:date>2023-09-08T06:48:38Z</dc:date>
    </item>
  </channel>
</rss>

