Class: Zernio::InstagramApi
- Inherits:
-
Object
- Object
- Zernio::InstagramApi
- Defined in:
- lib/zernio-sdk/api/instagram_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#get_instagram_audio(account_id, audio_id, opts = {}) ⇒ GetInstagramAudio200Response
Get Instagram audio metadata Fetch one audio asset's metadata by ID.
-
#get_instagram_audio_with_http_info(account_id, audio_id, opts = {}) ⇒ Array<(GetInstagramAudio200Response, Integer, Hash)>
Get Instagram audio metadata Fetch one audio asset's metadata by ID.
-
#get_instagram_publishing_limit(account_id, opts = {}) ⇒ GetInstagramPublishingLimit200Response
Get Instagram publishing limit Returns the account's remaining content-publishing quota for Instagram's rolling 24-hour window, so you can pace publishing and warn before the cap is reached.
-
#get_instagram_publishing_limit_with_http_info(account_id, opts = {}) ⇒ Array<(GetInstagramPublishingLimit200Response, Integer, Hash)>
Get Instagram publishing limit Returns the account's remaining content-publishing quota for Instagram's rolling 24-hour window, so you can pace publishing and warn before the cap is reached.
-
#get_instagram_story_insights(account_id, story_id, opts = {}) ⇒ GetInstagramStoryInsights200Response
Get Instagram story insights Returns metrics for a single story.
-
#get_instagram_story_insights_with_http_info(account_id, story_id, opts = {}) ⇒ Array<(GetInstagramStoryInsights200Response, Integer, Hash)>
Get Instagram story insights Returns metrics for a single story.
-
#initialize(api_client = ApiClient.default) ⇒ InstagramApi
constructor
A new instance of InstagramApi.
-
#list_instagram_stories(account_id, opts = {}) ⇒ ListInstagramStories200Response
List active Instagram stories Returns the IG Business/Creator account's currently-active stories.
-
#list_instagram_stories_with_http_info(account_id, opts = {}) ⇒ Array<(ListInstagramStories200Response, Integer, Hash)>
List active Instagram stories Returns the IG Business/Creator account's currently-active stories.
-
#search_instagram_audio(account_id, audio_type, opts = {}) ⇒ SearchInstagramAudio200Response
Search Instagram audio Search Instagram's audio catalog (licensed music or original sounds), or list what is currently trending by omitting
q. -
#search_instagram_audio_with_http_info(account_id, audio_type, opts = {}) ⇒ Array<(SearchInstagramAudio200Response, Integer, Hash)>
Search Instagram audio Search Instagram's audio catalog (licensed music or original sounds), or list what is currently trending by omitting `q`.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ InstagramApi
Returns a new instance of InstagramApi.
19 20 21 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#get_instagram_audio(account_id, audio_id, opts = {}) ⇒ GetInstagramAudio200Response
Get Instagram audio metadata
Fetch one audio asset's metadata by ID. Use it to re-validate a stored audioId before a scheduled Reel publishes, or to refresh the preview downloadUrl (Meta expires preview URLs after roughly 1.5 days). Same connection requirement as the search endpoint: Facebook-Login Instagram accounts only.
28 29 30 31 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 28 def get_instagram_audio(account_id, audio_id, opts = {}) data, _status_code, _headers = get_instagram_audio_with_http_info(account_id, audio_id, opts) data end |
#get_instagram_audio_with_http_info(account_id, audio_id, opts = {}) ⇒ Array<(GetInstagramAudio200Response, Integer, Hash)>
Get Instagram audio metadata Fetch one audio asset's metadata by ID. Use it to re-validate a stored `audioId` before a scheduled Reel publishes, or to refresh the preview `downloadUrl` (Meta expires preview URLs after roughly 1.5 days). Same connection requirement as the search endpoint: Facebook-Login Instagram accounts only.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 39 def get_instagram_audio_with_http_info(account_id, audio_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InstagramApi.get_instagram_audio ...' end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? fail ArgumentError, "Missing the required parameter 'account_id' when calling InstagramApi.get_instagram_audio" end # verify the required parameter 'audio_id' is set if @api_client.config.client_side_validation && audio_id.nil? fail ArgumentError, "Missing the required parameter 'audio_id' when calling InstagramApi.get_instagram_audio" end pattern = Regexp.new(/^\d{1,30}$/) if @api_client.config.client_side_validation && audio_id !~ pattern fail ArgumentError, "invalid value for 'audio_id' when calling InstagramApi.get_instagram_audio, must conform to the pattern #{pattern}." end # resource path local_var_path = '/v1/accounts/{accountId}/instagram/audio/{audioId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'audioId' + '}', CGI.escape(audio_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetInstagramAudio200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"InstagramApi.get_instagram_audio", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InstagramApi#get_instagram_audio\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_instagram_publishing_limit(account_id, opts = {}) ⇒ GetInstagramPublishingLimit200Response
Get Instagram publishing limit
Returns the account's remaining content-publishing quota for Instagram's rolling 24-hour window, so you can pace publishing and warn before the cap is reached. quotaUsage counts containers published since the start of the window. Always compare against the returned quotaTotal rather than hardcoding a number: Meta's prose documentation and the live API disagree on the value, and the live value is authoritative.
101 102 103 104 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 101 def get_instagram_publishing_limit(account_id, opts = {}) data, _status_code, _headers = get_instagram_publishing_limit_with_http_info(account_id, opts) data end |
#get_instagram_publishing_limit_with_http_info(account_id, opts = {}) ⇒ Array<(GetInstagramPublishingLimit200Response, Integer, Hash)>
Get Instagram publishing limit Returns the account's remaining content-publishing quota for Instagram's rolling 24-hour window, so you can pace publishing and warn before the cap is reached. `quotaUsage` counts containers published since the start of the window. Always compare against the returned `quotaTotal` rather than hardcoding a number: Meta's prose documentation and the live API disagree on the value, and the live value is authoritative.
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 111 def get_instagram_publishing_limit_with_http_info(account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InstagramApi.get_instagram_publishing_limit ...' end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? fail ArgumentError, "Missing the required parameter 'account_id' when calling InstagramApi.get_instagram_publishing_limit" end # resource path local_var_path = '/v1/accounts/{accountId}/instagram/publishing-limit'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetInstagramPublishingLimit200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"InstagramApi.get_instagram_publishing_limit", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InstagramApi#get_instagram_publishing_limit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_instagram_story_insights(account_id, story_id, opts = {}) ⇒ GetInstagramStoryInsights200Response
Get Instagram story insights
Returns metrics for a single story. The source field discriminates between three states: - live — fetched from Meta in real time (story is still active) - cached — fetched from a persisted story_insights webhook payload (story has expired but we received its final-state metrics from Meta) - unavailable — story has expired and we never received its webhook payload (for example, the account connected after the story expired) Meta can report an expired story as an empty successful result rather than an error, so an expired story resolves to cached or unavailable even though the upstream request itself succeeded. Field semantics follow Meta's API. Counts below 5 may be returned as 0 due to Meta's privacy floor on small audiences. The navigation field is the sum of tapsForward + tapsBack + exits + swipesForward.
165 166 167 168 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 165 def get_instagram_story_insights(account_id, story_id, opts = {}) data, _status_code, _headers = get_instagram_story_insights_with_http_info(account_id, story_id, opts) data end |
#get_instagram_story_insights_with_http_info(account_id, story_id, opts = {}) ⇒ Array<(GetInstagramStoryInsights200Response, Integer, Hash)>
Get Instagram story insights Returns metrics for a single story. The `source` field discriminates between three states: - `live` — fetched from Meta in real time (story is still active) - `cached` — fetched from a persisted `story_insights` webhook payload (story has expired but we received its final-state metrics from Meta) - `unavailable` — story has expired and we never received its webhook payload (for example, the account connected after the story expired) Meta can report an expired story as an empty successful result rather than an error, so an expired story resolves to `cached` or `unavailable` even though the upstream request itself succeeded. Field semantics follow Meta's API. Counts below 5 may be returned as 0 due to Meta's privacy floor on small audiences. The `navigation` field is the sum of `tapsForward + tapsBack + exits + swipesForward`.
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 176 def get_instagram_story_insights_with_http_info(account_id, story_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InstagramApi.get_instagram_story_insights ...' end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? fail ArgumentError, "Missing the required parameter 'account_id' when calling InstagramApi.get_instagram_story_insights" end # verify the required parameter 'story_id' is set if @api_client.config.client_side_validation && story_id.nil? fail ArgumentError, "Missing the required parameter 'story_id' when calling InstagramApi.get_instagram_story_insights" end # resource path local_var_path = '/v1/accounts/{accountId}/instagram/stories/{storyId}/insights'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'storyId' + '}', CGI.escape(story_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetInstagramStoryInsights200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"InstagramApi.get_instagram_story_insights", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InstagramApi#get_instagram_story_insights\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_instagram_stories(account_id, opts = {}) ⇒ ListInstagramStories200Response
List active Instagram stories
Returns the IG Business/Creator account's currently-active stories. Meta keeps stories live for 24h; expired stories are not returned. Limitations propagated from Meta (these are NOT bugs): - 24h window only - Live videos excluded - Reshared stories not returned - mediaUrl may be null if Meta flagged the story for copyright - caption, likeCount, commentsCount do not apply to story media
233 234 235 236 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 233 def list_instagram_stories(account_id, opts = {}) data, _status_code, _headers = list_instagram_stories_with_http_info(account_id, opts) data end |
#list_instagram_stories_with_http_info(account_id, opts = {}) ⇒ Array<(ListInstagramStories200Response, Integer, Hash)>
List active Instagram stories Returns the IG Business/Creator account's currently-active stories. Meta keeps stories live for 24h; expired stories are not returned. Limitations propagated from Meta (these are NOT bugs): - 24h window only - Live videos excluded - Reshared stories not returned - `mediaUrl` may be null if Meta flagged the story for copyright - `caption`, `likeCount`, `commentsCount` do not apply to story media
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 243 def list_instagram_stories_with_http_info(account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InstagramApi.list_instagram_stories ...' end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? fail ArgumentError, "Missing the required parameter 'account_id' when calling InstagramApi.list_instagram_stories" end # resource path local_var_path = '/v1/accounts/{accountId}/instagram/stories'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ListInstagramStories200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"InstagramApi.list_instagram_stories", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InstagramApi#list_instagram_stories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#search_instagram_audio(account_id, audio_type, opts = {}) ⇒ SearchInstagramAudio200Response
Search Instagram audio
Search Instagram's audio catalog (licensed music or original sounds), or list what is currently trending by omitting q. Returns up to ~30 assets; Meta exposes no pagination on this edge. Pass the returned audioId as platformSpecificData.audioConfiguration.audioId when creating a Reel to publish it with that track. Requires an Instagram account connected via Facebook Login. Meta hosts this catalog on graph.facebook.com only, so accounts connected with classic Instagram Login receive a 400 (instagram_audio_requires_facebook_login) and must be reconnected choosing the Facebook option.
298 299 300 301 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 298 def search_instagram_audio(account_id, audio_type, opts = {}) data, _status_code, _headers = search_instagram_audio_with_http_info(account_id, audio_type, opts) data end |
#search_instagram_audio_with_http_info(account_id, audio_type, opts = {}) ⇒ Array<(SearchInstagramAudio200Response, Integer, Hash)>
Search Instagram audio Search Instagram's audio catalog (licensed music or original sounds), or list what is currently trending by omitting `q`. Returns up to ~30 assets; Meta exposes no pagination on this edge. Pass the returned `audioId` as `platformSpecificData.audioConfiguration.audioId` when creating a Reel to publish it with that track. Requires an Instagram account connected via Facebook Login. Meta hosts this catalog on graph.facebook.com only, so accounts connected with classic Instagram Login receive a 400 (`instagram_audio_requires_facebook_login`) and must be reconnected choosing the Facebook option.
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 310 def search_instagram_audio_with_http_info(account_id, audio_type, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InstagramApi.search_instagram_audio ...' end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? fail ArgumentError, "Missing the required parameter 'account_id' when calling InstagramApi.search_instagram_audio" end # verify the required parameter 'audio_type' is set if @api_client.config.client_side_validation && audio_type.nil? fail ArgumentError, "Missing the required parameter 'audio_type' when calling InstagramApi.search_instagram_audio" end # verify enum value allowable_values = ["music", "original_sound"] if @api_client.config.client_side_validation && !allowable_values.include?(audio_type) fail ArgumentError, "invalid value for \"audio_type\", must be one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'q'].nil? && opts[:'q'].to_s.length > 200 fail ArgumentError, 'invalid value for "opts[:"q"]" when calling InstagramApi.search_instagram_audio, the character length must be smaller than or equal to 200.' end if @api_client.config.client_side_validation && !opts[:'q'].nil? && opts[:'q'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"q"]" when calling InstagramApi.search_instagram_audio, the character length must be greater than or equal to 1.' end # resource path local_var_path = '/v1/accounts/{accountId}/instagram/audio'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'audioType'] = audio_type query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'SearchInstagramAudio200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"InstagramApi.search_instagram_audio", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InstagramApi#search_instagram_audio\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |