blockcypher/explorer

HTTP 403 - invalid character '<' looking for beginning of value

gregnomis opened this issue · 2 comments

I am using GET requests for tx details:

object BlockCypherAPI {
    private const val BASE_URL = "https://api.blockcypher.com/v1/btc/main/"
    private const val API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxx"

    interface ApiService {
        @GET("txs/{txid}")
        suspend fun getTransactionDetails(
            @Path("txid") txid: String,
            @Query("token") apiKey: String = API_KEY
        ): TransactionDetails
    }


    private val retrofit: Retrofit = Retrofit.Builder()
        .baseUrl(BASE_URL)
        .addConverterFactory(GsonConverterFactory.create())
        .build()

    val apiService: ApiService = retrofit.create(ApiService::class.java)
}

data class TransactionDetails(
    val hash: String,
    val confirmations: Int,
    val outputs: List<Output>
)

Every now and then, seemingly randomly, my android app logcat throws me a HTTP 403 error, and when I check my token usage I get this error on the blockcypher website: invalid character '<' looking for beginning of value

Some sort of JSON error I assume.... but on whose end?
My token limits are good, token active, and my API requests work on and off but will randomly have this occur... what's going on?

Does Blockcypher have a IP related endpoint restrictions? I am testing the GET requests quite frequently from the same device and network. As mentioned, it will work randomly. Any ideas?

The only thing I could find from blockcypher regarding 403s is this update:

14/10/21 - Fix Websocket Origin Check

We fixed an error where using blockcypher websocket would returns a 403.

But I am not using websockets....
Could really use some insight here, sooner than later please. Trying to release this app on a timeline

Lol what a joke. Zero response from support email either. Switched to blockchain.com's API. The results speak for themselves. Bye bye.
wow