kovpas / itc.cli

iTunesConnect command line interface
211 stars 23 forks source link

Redesign of itunes connect #38

Closed spidfire closed 9 years ago

spidfire commented 10 years ago

I saw Itunes connect is now switched to an angular frontend Maybe we can make a joint effort to document the api calls (and afterward create the app)?

I've found some (easy) api calls already

summary of your apps: https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/manageyourapps/summary

Details of one app: https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/detail/{appid}

Versions: https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/version/{appid}

kovpas commented 10 years ago

Nice list, thanks!

bernard1 commented 10 years ago

https://itunesconnect.apple.com//WebObjects/iTunesConnect.woa//ra/apps/manageyourapps/summary is your all application data, encode with json. it should be big deference with old one. other post action and parameter is same.

bernard1 commented 10 years ago

I change one of function and it works ok now

itdaren commented 10 years ago

bernard1, how did you make it work for the new iTunesConnect? I can not even log in.

bernard1 commented 10 years ago

def login(self, login=None, password=None): print 'login Url:'+self._loginPageURL

    if self.isLoggedIn:
        logging.debug('Login: already logged in')
        return
    tree = self._parser.parseTreeForURL(self._loginPageURL)
    forms = tree.xpath("//form")

    if len(forms) == 0:
        raise

    form = forms[0]
    actionURL = form.attrib['action']

    payload = {'theAccountName': (self._info['username'] if login == None else login)
             , 'theAccountPW': (self._info['password'] if password == None else password)
             , '1.Continue.x': 0
             , '1.Continue.y': 0
             , 'theAuxValue': ''
             , 'inframe':0 }

    # actually only return a page have a js code then use this js code to get all thing.
    # so this already login 
    mainPageTree = self._parser.parseTreeForURL(actionURL, method="POST", payload=payload)
    mainBaseHref = mainPageTree.xpath("//base[@href]")

    if len(mainBaseHref) >0:
        self.isLoggedIn = True
        logging.info("Login: logged in. Session cookies are saved to " + cookie_file)
        cookie_jar.save(cookie_file, ignore_discard=True)
    else:
        raise Exception('Cannot continue: login failed. Please check username/password')

    self._parser.parseTreeForURL('/WebObjects/iTunesConnect.woa/ra/ng/app', method="GET",payload=payload)
itdaren commented 10 years ago

bernard1, why not post all your code here? such as meta data edit, etc. It'll be very helpful. Thanks.

nicgrayson commented 10 years ago

I found some more json endpoints to make this easy:

If you GET: https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/version/#{app_id}

You can change the json then do a POST to: https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/version/save/#{app_id}

You can create a new version of an app with a POST here: https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/version/create/#{app_id}

If you don't know your app id you can get it here (obviously some ruby here): response = JSON.parse(agent.get('https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/manageyourapps/summary').body)['data']['summaries'] response.each do |hash| if hash['name'] == app_name return hash['adamId'] end end

bernard1 commented 10 years ago

Useful links

Thanks Nic

Nic Grayson wrote:

I found some more json endpoints to make this easy:

If you GET: https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/version/#{app_id}

https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/version/#%7Bapp_id%7D

You can change the json then do a POST to: https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/version/save/#{app_id}

https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/version/save/#%7Bapp_id%7D

You can create a new version of an app with a POST here: https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/version/create/#{app_id}

https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/version/create/#%7Bapp_id%7D

If you don't know your app id you can get it here (obviously some ruby here): response = JSON.parse(agent.get('https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/manageyourapps/summary').body)['data']['summaries']

https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/manageyourapps/summary').body)%5B'data'%5D%5B'summaries'%5D response.each do |hash| if hash['name'] == app_name return hash['adamId'] end end

— Reply to this email directly or view it on GitHub https://github.com/kovpas/itc.cli/issues/38#issuecomment-57336168.

jimthedev commented 10 years ago

@nicgrayson Have you worked on getting authentication working?

nicgrayson commented 10 years ago

I use ruby mechanize for this.

def login(user,pass)
    a = Mechanize.new { |agent|
      agent.user_agent_alias = 'Mac Safari'
    }

    page = a.get('https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa')
    main_page = page.form_with(:name => 'appleConnectForm') do |f|
      f.theAccountName = user
      f.theAccountPW = pass
    end.submit
    if main_page.form_with(:name => 'appleConnectForm')
      puts "Error logging in as #{user}"
      return nil
    else
      return a
    end
  end

I haven't found a nice endpoint for it.

maxchu2021 commented 10 years ago

Anyone have a clue about upload Screenshots?

nicgrayson commented 10 years ago

I've tried to get this working. I found the endpoint but you need to set a few headers. One of the headers needs a value that returns from executing some javascript. I gave up on it after finding that out.

On Tue, Oct 28, 2014 at 5:35 AM, KeaNy notifications@github.com wrote:

Anyone have a clue about upload Screenshots?

— Reply to this email directly or view it on GitHub https://github.com/kovpas/itc.cli/issues/38#issuecomment-60736164.

KrauseFx commented 9 years ago

I want to thank you all for posting the URLs here, I started integrating them into deliver: https://github.com/KrauseFx/deliver/pull/113/files

kovpas commented 9 years ago

@KrauseFx :+1:

KrauseFx commented 9 years ago

Not 100% done yet, but I started an open source documentation of the iTunes Connect API: https://github.com/fastlane/itc-api-docs/

If you know anything else, feel free to contribute to the project :+1:

KrauseFx commented 9 years ago

You might be interested in what I'm working on right now: https://github.com/fastlane/spaceship/pull/58

I released spaceship, which will soon be able to also access all relevant features of iTunes Connect using a Ruby library. Let me know what you think.

jimthedev commented 9 years ago

Nice @krausefx! How is this different from https://github.com/nomad/shenzhen?

jimthedev commented 9 years ago

Also @krausefx, are you aware of any thing that does this for android apks?

KrauseFx commented 9 years ago

@jimthedev shenzhen is almost in no way related to spaceship. spaceship exposes a Ruby API for all resources of the Dev Portal and iTunes Connect. So you can write your own tools with it, without having to think about the underlying API from Apple. shenzhen is only about building and uploading your ipa file. It is actually integrated into fastlane.

I'm actually working on something similar for Android, you can follow the fastlane project to stay up to date :+1: