Results 1 to 8 of 8

Thread: API get current war log limited response

  1. #1

    Question API get current war log limited response

    So i am trying to write a Telegram bot, and i need for testing purposes to call the COC API multiple times. First response is okay, the second one is getting 403 Access Denied. Is there a limit, how often an API can be called?

    After few minutes of waiting, i can call it again. Is there any limitations on how often i can call it? Clan Log is not private.

  2. #2
    Fresh Spawn
    Join Date
    Sep 2019
    Location
    Finland
    Posts
    7
    There is a throttling limit for API calls and based on my tests you start to see throttling errors when you go above 80 request/second, this however depends on the API token!

    When you hit the maximum amount of requests per second limit (based on your token) you will see error code 429 (StatusCode: 429, ReasonPhrase: 'Too Many Requests') but in your case if you see 403 then it is not the throttling limit error you are seeing.

    When the war log is private and you try to read it you will see 403 error but because you already commented that war log is public then without more information it is difficult to help. BTW Supercell documentation for 403 says:

    403: Access denied, either because of missing/incorrect credentials or used API token does not grant access to the requested resource
    If you know exactly how to reproduce this issue then please provide the exact steps then we might be able to help more.
    .NET Standard library for Clash of Clans API @ https://github.com/tparviainen/clashofclans

  3. #3
    Here is what i do, i am using ruby where i call the api.
    uri = URI.parse("https://api.clashofclans.com/v1/clans/#{clan_tag}/currentwar")
    Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
    request = Net::HTTP::Get.new uri
    request['authorization'] = "Bearer <#{coctoken}>"
    res = http.request request # Net::HTTPResponse object
    parsed = JSON.parse(res.body)
    end


    The parsed variable is used later on. What i often get as a response is
    {"reason":"accessDenied","message":"Invalid authorization"}

    I get this message, if i call the API more then twice a minute. Thats not the way it should work i think...


    Clan tag: #988GYYLP

    Maybe my error refers to this post:
    https://forum.supercell.com/showthre...oblem-with-API
    Last edited by KillerAgent; 1 Week Ago at 04:52 PM.

  4. #4
    Fresh Spawn
    Join Date
    Sep 2019
    Location
    Finland
    Posts
    7
    I'm able to read your clan's war log like 75 times/second without any issues.

    If I try to read a war log from a clan that has a private war log I get StatusCode: 403, ReasonPhrase: 'Forbidden'.

    However if I add for example extra characters to my token and try to access the API I get {"reason":"accessDenied","message":"Invalid authorization"} so based on that I would say that you need to analyse that your token remains the same between SC API requests, maybe you accidentally delete your token or modify it somehow ...
    .NET Standard library for Clash of Clans API @ https://github.com/tparviainen/clashofclans

  5. #5
    Thanks for your reply... This is what i am doing, just created a new ruby (.rb) file and pasted this in. What is wrong with this one.
    Running it with ruby *name.rb

    require 'uri'
    require 'net/http'
    require 'net/https'
    require 'json'
    require 'active_support/json'

    coctoken = 'HEREISMYTOKENINPLAINTEXTWHICHISVERYLONG'

    clan_tag = '#988GYYLP'
    clan_tag.gsub!('#', '%23')

    uri = URI.parse("https://api.clashofclans.com/v1/clans/#{clan_tag}/currentwar")

    Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
    request = Net::HTTP::Get.new uri
    request['authorization'] = "Bearer <#{coctoken}>"
    res = http.request request # Net::HTTPResponse object
    parsed = JSON.parse(res.body)
    puts res.body
    end

  6. #6
    Even if i call this command from terminal 2 times in a row, i get an error:

    curl -X GET --header 'Accept: application/json' --header "authorization: Bearer <MYTOKENISHERE>" 'https://api.clashofclans.com/v1/clans/%23988GYYLP/currentwar'

    Code copied from documentaion
    Last edited by KillerAgent; 1 Week Ago at 08:30 PM.

  7. #7
    Fresh Spawn
    Join Date
    Sep 2019
    Location
    Finland
    Posts
    7
    I can execute that curl-command several times in a row without issues.
    .NET Standard library for Clash of Clans API @ https://github.com/tparviainen/clashofclans

  8. #8
    So the problem is either with my token or my location/ip/hardware/account? Really strange...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •