{"id":2660,"date":"2022-04-22T13:19:00","date_gmt":"2022-04-22T13:19:00","guid":{"rendered":"https:\/\/www.reloadly.com\/blog\/?p=2660"},"modified":"2022-04-20T13:19:42","modified_gmt":"2022-04-20T13:19:42","slug":"how-to-test-api-numbers-different-countries","status":"publish","type":"post","link":"https:\/\/blog.reloadly.com\/blog\/how-to-test-api-numbers-different-countries\/","title":{"rendered":"How to test Reloadly&#8217;s API with numbers from different countries?"},"content":{"rendered":"\n<p>If you&#8217;re just starting using Reloadly&#8217;s Top-Ups API, it makes sense to run a few tests before you go all-in.<\/p>\n\n\n\n<p>To run these tests without affecting your actual balance you can use the <a href=\"https:\/\/docs.reloadly.com\/devtools\/toolbox\/sandbox\">SandBox environment<\/a>.<\/p>\n\n\n\n<p>It works exactly like production but, in order to have it completely isolated from one another, there&#8217;s a separate set of credentials.<\/p>\n\n\n\n<p>So, the first thing you need to do is to get an access token specific to this environment, like this:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> curl --location --request POST 'https:\/\/auth.reloadly.com\/oauth\/token' \\\n      --header 'Content-Type: application\/json' \\\n      --data-raw '{\n           \"client_id\":\"$CLIENT_ID\",\n           \"client_secret\":\"$CLIENT_SECRET\",\n           \"grant_type\":\"client_credentials\",\n           \"audience\":\"https:\/\/topups-sandbox.reloadly.com\"\n      }'<\/pre>\n\n\n\n<p>Just replace <code data-enlighter-language=\"raw\" class=\"EnlighterJSRAW\">$CLIENT_ID<\/code> and <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">$CLIENT_SECRET<\/code> with the values found in <a href=\"https:\/\/www.reloadly.com\/developers\/api-settings\">your dashboard<\/a>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"978\" height=\"340\" src=\"https:\/\/www.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/Sandbox-credentials.png\" alt=\"\" class=\"wp-image-2661\" srcset=\"https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/Sandbox-credentials.png 978w, https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/Sandbox-credentials-300x104.png 300w, https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/Sandbox-credentials-768x267.png 768w\" sizes=\"(max-width: 978px) 100vw, 978px\" \/><figcaption>SandBox credentials<\/figcaption><\/figure>\n\n\n\n<p>Make sure you are in development mode, otherwise the following calls will fail:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"842\" height=\"438\" src=\"https:\/\/www.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/Test-mode-on.png\" alt=\"\" class=\"wp-image-2662\" srcset=\"https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/Test-mode-on.png 842w, https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/Test-mode-on-300x156.png 300w, https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/Test-mode-on-768x400.png 768w\" sizes=\"(max-width: 842px) 100vw, 842px\" \/><figcaption>Test mode ON<\/figcaption><\/figure>\n\n\n\n<p>Then you can use the token to issue requests to the server like this:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl --location --request POST 'https:\/\/topups-sandbox.reloadly.com\/topups' \\\n     --header 'Authorization: Bearer $TOKEN' \\\n     --header 'Accept: application\/com.reloadly.topups-v1+json' \\\n     --header 'Content-Type: application\/json' \\\n     --data-raw '{\n          \"operatorId\":\"$OPERATOR_ID\",\n          \"amount\":\"$AMOUNT\",\n          \"recipientPhone\": {\n              \"countryCode\": \"$COUNTRY_CODE\",\n              \"number\": \"$RECIPIENT_NUMBER\"\n          }\n     }'<\/pre>\n\n\n\n<p>Note how the URL contains a <code>-sandbox<\/code> as part of the domain name. That is indicating you&#8217;re interacting with the test servers.<\/p>\n\n\n\n<p>Just replace the variables with the values you want to use and that&#8217;s it.<\/p>\n\n\n\n<p>You can use this call with any number you want.<\/p>\n\n\n\n<p>If don&#8217;t know the operator, you can find out by making a request to the <a href=\"https:\/\/docs.reloadly.com\/airtime\/operators\/auto-detect-an-operator\">auto-detect endpoint<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to generate test mobile numbers for different countries<\/h2>\n\n\n\n<p>With what you learned so far you can test the API with any phone number you want. But what if you don&#8217;t have any particular number to use for testing?<\/p>\n\n\n\n<p>Generating random numbers yourself can be really challenging since the format for each country can dramatically change.<\/p>\n\n\n\n<p>Luckily, someone has done it for you.<\/p>\n\n\n\n<p>There are services like <a href=\"https:\/\/fakenumber.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">FakeNumber<\/a> or <a href=\"https:\/\/randommer.io\/Phone\" target=\"_blank\" rel=\"noreferrer noopener\">RandomNumber<\/a> where, with just a couple of clicks you&#8217;ll get results such as:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"796\" height=\"347\" src=\"https:\/\/www.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/image-1.png\" alt=\"\" class=\"wp-image-2664\" srcset=\"https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/image-1.png 796w, https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/image-1-300x131.png 300w, https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/image-1-768x335.png 768w\" sizes=\"(max-width: 796px) 100vw, 796px\" \/><figcaption>Fake Nigeria phones<\/figcaption><\/figure>\n\n\n\n<p>Or:<\/p>\n\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"830\" height=\"271\" src=\"https:\/\/www.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/image.png\" alt=\"\" class=\"wp-image-2663\" srcset=\"https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/image.png 830w, https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/image-300x98.png 300w, https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/image-768x251.png 768w\" sizes=\"(max-width: 830px) 100vw, 830px\" \/><figcaption><br>Random Bermuda phone number<\/figcaption><\/figure><\/div>\n\n\n\n<p>You can generate as many random numbers as you need and use them in subsequent calls to Reloadly&#8217;s APIs.<\/p>\n\n\n\n<p>In fact, you can even <a href=\"https:\/\/randommer.io\/randommer-api\" target=\"_blank\" rel=\"noreferrer noopener\">generate them programmatically<\/a> and put together a script to automate both the number generation and top-up test.<\/p>\n\n\n\n<p>Don&#8217;t let the unavailability of phone numbers become a roadblock for powering up your applications with Reloadly&#8217;s APIs. <\/p>\n\n\n\n<p>Start testing today. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to leverage Reloadly&#8217;s Sandbox environment to test your API calls without consuming credit<\/p>\n","protected":false},"author":22,"featured_media":2671,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[274],"tags":[372,371,14],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to test Reloadly&#039;s API with numbers from different countries? - Reloadly<\/title>\n<meta name=\"description\" content=\"Are you looking for a way to test Reloadly&#039;s APIs without consuming your credit? Learn how to use the Sandbox environment with test numbers\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.reloadly.com\/blog\/how-to-test-api-numbers-different-countries\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to test Reloadly&#039;s API with numbers from different countries? - Reloadly\" \/>\n<meta property=\"og:description\" content=\"Are you looking for a way to test Reloadly&#039;s APIs without consuming your credit? Learn how to use the Sandbox environment with test numbers\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.reloadly.com\/blog\/how-to-test-api-numbers-different-countries\/\" \/>\n<meta property=\"og:site_name\" content=\"Reloadly\" \/>\n<meta property=\"article:published_time\" content=\"2022-04-22T13:19:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-20T13:19:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/blog-image53-01.png\" \/>\n\t<meta property=\"og:image:width\" content=\"641\" \/>\n\t<meta property=\"og:image:height\" content=\"334\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"3 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.reloadly.com\/blog\/#organization\",\"name\":\"Reloadly\",\"url\":\"https:\/\/www.reloadly.com\/blog\/\",\"sameAs\":[],\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.reloadly.com\/blog\/#logo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2020\/11\/logo-1.svg\",\"width\":100,\"height\":100,\"caption\":\"Reloadly\"},\"image\":{\"@id\":\"https:\/\/www.reloadly.com\/blog\/#logo\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.reloadly.com\/blog\/#website\",\"url\":\"https:\/\/www.reloadly.com\/blog\/\",\"name\":\"Reloadly\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.reloadly.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.reloadly.com\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/blog.reloadly.com\/blog\/how-to-test-api-numbers-different-countries\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2022\/04\/blog-image53-01.png\",\"width\":641,\"height\":334},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.reloadly.com\/blog\/how-to-test-api-numbers-different-countries\/#webpage\",\"url\":\"https:\/\/blog.reloadly.com\/blog\/how-to-test-api-numbers-different-countries\/\",\"name\":\"How to test Reloadly's API with numbers from different countries? - Reloadly\",\"isPartOf\":{\"@id\":\"https:\/\/www.reloadly.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/blog.reloadly.com\/blog\/how-to-test-api-numbers-different-countries\/#primaryimage\"},\"datePublished\":\"2022-04-22T13:19:00+00:00\",\"dateModified\":\"2022-04-20T13:19:42+00:00\",\"description\":\"Are you looking for a way to test Reloadly's APIs without consuming your credit? Learn how to use the Sandbox environment with test numbers\",\"breadcrumb\":{\"@id\":\"https:\/\/blog.reloadly.com\/blog\/how-to-test-api-numbers-different-countries\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.reloadly.com\/blog\/how-to-test-api-numbers-different-countries\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.reloadly.com\/blog\/how-to-test-api-numbers-different-countries\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.reloadly.com\/blog\/\",\"url\":\"https:\/\/www.reloadly.com\/blog\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.reloadly.com\/blog\/how-to-test-api-numbers-different-countries\/\",\"url\":\"https:\/\/blog.reloadly.com\/blog\/how-to-test-api-numbers-different-countries\/\",\"name\":\"How to test Reloadly&#8217;s API with numbers from different countries?\"}}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/blog.reloadly.com\/blog\/how-to-test-api-numbers-different-countries\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/blog.reloadly.com\/blog\/how-to-test-api-numbers-different-countries\/#webpage\"},\"author\":{\"@id\":\"https:\/\/www.reloadly.com\/blog\/#\/schema\/person\/b7f57cdec858524713a40069354fc55b\"},\"headline\":\"How to test Reloadly&#8217;s API with numbers from different countries?\",\"datePublished\":\"2022-04-22T13:19:00+00:00\",\"dateModified\":\"2022-04-20T13:19:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/blog.reloadly.com\/blog\/how-to-test-api-numbers-different-countries\/#webpage\"},\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.reloadly.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/blog.reloadly.com\/blog\/how-to-test-api-numbers-different-countries\/#primaryimage\"},\"keywords\":\"sandbox,test,top up api\",\"articleSection\":\"Developer Blog\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/blog.reloadly.com\/blog\/how-to-test-api-numbers-different-countries\/#respond\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.reloadly.com\/blog\/#\/schema\/person\/b7f57cdec858524713a40069354fc55b\",\"name\":\"Mauro Chojrin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.reloadly.com\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/2e0c52b5f88c4911eeb351e93b0dab9a?s=96&d=mm&r=g\",\"caption\":\"Mauro Chojrin\"},\"url\":\"https:\/\/blog.reloadly.com\/blog\/author\/mauro-chojrin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","authors":[{"term_id":361,"user_id":22,"is_guest":0,"slug":"mauro-chojrin","display_name":"Mauro Chojrin"}],"_links":{"self":[{"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/posts\/2660"}],"collection":[{"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/comments?post=2660"}],"version-history":[{"count":2,"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/posts\/2660\/revisions"}],"predecessor-version":[{"id":2672,"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/posts\/2660\/revisions\/2672"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/media\/2671"}],"wp:attachment":[{"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/media?parent=2660"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/categories?post=2660"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/tags?post=2660"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}