title: How to call this API in Kotlin?
body: <p>I'm trying to call this API:
  <a href="https://dog-facts-api.herokuapp.com/api/v1/resources/dogs?number=2" rel="nofollow noreferrer">https://dog-facts-api.herokuapp.com/api/v1/resources/dogs?number=2</a></p>
  <p>As you can see, it returns a Json with random facts about dogs,
  my problem is when I put my baseUrl with retrofit:</p>
  <pre><code>private fun getRetrofit(): Retrofit{
          return Retrofit.Builder()
              .baseUrl(&quot;https://dog-facts-api.herokuapp.com/api/v1/resources/dogs?number=&quot;)
              .addConverterFactory(GsonConverterFactory.create())
              .build()
      }
  </code></pre>
  <p>If I put the url like that, it doesn't work, because it says that must end with an &quot;/&quot;
  But if I add it, it doesn't work.</p>
  <p>Also, I tried to put just like:</p>
  <pre><code>.baseUrl(&quot;https://dog-facts-api.herokuapp.com/api/v1/resources/&quot;)
  </code></pre>
  <p>And making the call like this:</p>
  <pre><code>val call = getRetrofit().create(APIService::class.java).getFactsByNumber(&quot;dogs?number=$number&quot;)
  </code></pre>
  <p>But again, it didn't work, it throws an error:</p>
  <p>E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1
  Process: com.eltonga.dogfacts, PID: 11927
  com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $</p>
  <p>My Interface:</p>
  <pre><code>interface APIService {
      @GET
      suspend fun getFactsByNumber(@Url url: String): Response&lt;FactsResponse&gt;
  }
  </code></pre>
  <p>My data class:</p>
  <pre><code>data class FactsResponse(var fact: List&lt;String&gt;)
  </code></pre>
  <p>The function where I call the API:</p>
  <pre><code>private fun searchByNumber(number:Int){
          CoroutineScope(Dispatchers.IO).launch {
              val call = getRetrofit().create(APIService::class.java).getFactsByNumber(&quot;dogs?number=$number&quot;)
              val the_facts = call.body()
  
              runOnUiThread {
                  if(call.isSuccessful){
                      val factsData = the_facts?.fact ?: emptyList()
                      facts.clear()
                      facts.addAll(factsData)
                      adapter.notifyDataSetChanged()
                  }else{
                      Toast.makeText(binding.btnGo.context, &quot;Error&quot;, Toast.LENGTH_SHORT).show()
                  }
              }
  
          }
      }
  </code></pre>
  <p>What can I do? I'm pretty new working with API</p>