Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I set GET query parameters? #90

Closed
abgier-blitzm opened this issue Oct 23, 2019 · 1 comment
Closed

How do I set GET query parameters? #90

abgier-blitzm opened this issue Oct 23, 2019 · 1 comment

Comments

@abgier-blitzm
Copy link

https://developer.apple.com/documentation/appstoreconnectapi/list_and_download_profiles#query-parameters

Lets say I want to call GET https://api.appstoreconnect.apple.com/v1/profiles and filter by bundleIds.

How would I do this? Is it still done from app_store_connect.profiles?

@kyledecot
Copy link
Owner

kyledecot commented Oct 24, 2019

Both URL and query parameters are passed as the first argument. For example:

app_store_connect.profiles(
  limit: 1,
  filter: { 
    name: 'Kyle Decot\'s Development Profile', 
    profile_type: 'IOS_APP_DEVELOPMENT' 
  }
)

If you want to filter by Bundle ID (com.kyledecot.Example) I think you'd need to do something like:

require 'app_store_connect'

app_store_connect = AppStoreConnect::Client.new
bundle_id_identifier = 'com.kyledecot.Example'

response = app_store_connect.profiles(
  include: 'bundleId',
  fields: {
    profiles: 'bundleId',
    bundle_ids: 'identifier'
  }
)

bundle_id = response['included']
  .select { |i| i['type'] == 'bundleIds' }
  .detect({}) { |i| i.dig('attributes', 'identifier') == bundle_id_identifier }

profiles = response['data']
  .select { |d| bundle_id['id'] == d.dig('relationships', 'bundleId', 'data', 'id') }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants