2020TAndr's blog

By 2020TAndr, history, 13 months ago, In English

Haven't found any way to access standings of contest which belongs to a group, even when anybody can see them (e.g. https://codeforces.com/group/a7fj9QBnKu/contest/333884/standings).

UPD1: I tried to find the contest in 'contest.list', but it doesn't show there, even with my API key. As well, I tried to add parameter 'group'/'groupId' in link, but that doesn't work too.

Tags api
 
 
 
 
  • Vote: I like it
  • +20
  • Vote: I do not like it

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

'groupCode' worked for me.

I found it here

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it -10 Vote: I do not like it

    didn't work for me

    can you show an example ?

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      This is using the example from codeforces api page:

      If your key is xxx, secret is yyy, chosen rand is 123456 and you want to access method contest.hacks for contest 566 in a group with groupCode 789, you should compose request like this: https://codeforces.com/api/contest.hacks?groupCode=789&contestId=566&apiKey=xxx&time=1657307946&apiSig=123456<hash>, where <hash> is sha512Hex(123456/contest.hacks?apiKey=xxx&contestId=566&groupCode=789&time=1657307946#yyy)


      Here is my python sample

              import requests, hashlib
              rand = random.randint(0, 100000)
              rand = str(rand).zfill(6)
              current_time = str(int(time.time()))
              api_sig = rand + '/contest.status?apiKey=' + api_key + '&contestId=' + contest_id + '&groupCode=' + group_code + '&time=' + current_time + '#' + api_secret
              hash = hashlib.sha512(api_sig.encode()).hexdigest()
              data = requests.get(f'https://codeforces.com/api/contest.status?groupCode={group_code}&contestId={contest_id}&apiKey={api_key}&time={current_time}&apiSig={rand+hash}').json()
          
      
      • »
        »
        »
        »
        5 weeks ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        {'status': 'FAILED', 'comment': 'contestId: Contest with id 387969 not found'}

        Still not working

        in codeforces api page there is no any thing about groupcode

        maybe they removed this future from codeforces ?!

        • »
          »
          »
          »
          »
          5 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Groupcode was not mentioned in the api page, I just meant that I was going to clarify using the same example.

          (This is just a theory I might be wrong) I think you need a certain privilege to be able to do that. I tested only using two groups, I was able to get results from the one where I was a manager, and did not get results in which I was just a participant.

          • »
            »
            »
            »
            »
            »
            5 weeks ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Got it, i found out that i have to be manager. Ty for your response