Giter Site home page Giter Site logo

Comments (10)

joaquincorrales avatar joaquincorrales commented on April 20, 2024

I don't think so. What are you trying to accomplish?

Also, do you know if there's anyway for us to catch error codes? The exception for a limited app or an invalid access token can only be caught as a string with a begin rescue.

from facebook-ruby-business-sdk.

joephayes avatar joephayes commented on April 20, 2024

from facebook-ruby-business-sdk.

joaquincorrales avatar joaquincorrales commented on April 20, 2024

The name of the image is assigned on upload. Use that name and the hashes that come back

from facebook-ruby-business-sdk.

joephayes avatar joephayes commented on April 20, 2024

Also, do you know if there's anyway for us to catch error codes? The exception for a limited app or an invalid access token can only be caught as a string with a begin rescue.

I don't.

from facebook-ruby-business-sdk.

joephayes avatar joephayes commented on April 20, 2024

One thing I did find is that we can get to the last API response:

...
results = ad_account.adimages.create(files_to_upload)

last_response = ad_account.last_api_response

puts last_response

returns something like this:

#<FacebookAds::APIResponse:0x0000XXXXXXX @status_code=200,
@headers={"access-control-allow-origin"=>"*", "pragma"=>"no-cache", "cache-control"=>"private, no-cache, no-store, must-revalidate", "facebook-api-version"=>"v3.0", "expires"=>"Sat, 01 Jan 2000 00:00:00 GMT", "x-fb-rev"=>"4114154", "content-type"=>"application/json; charset=UTF-8", "x-fb-trace-id"=>"XXXXXXX", "strict-transport-security"=>"max-age=15552000; preload", "vary"=>"Accept-Encoding", "x-fb-debug"=>"XXXXXXX", "date"=>"Wed, 18 Jul 2018 14:04:01 GMT", "connection"=>"close", "content-length"=>"425"},
@body="{\"images\":{\"elephant.png\":{\"hash\":\"XXXXX\",\"url\":\"https:\\/\\/scontent.xx.fbcdn.net\\/v\\/t45.1600-4\\/XXXXX\"},\"nodejs-logo.png\":{\"hash\":\"XXXXX\",\"url\":\"https:\\/\\/scontent.xx.fbcdn.net\\/v\\/t45.1600-4\\/XXXXX\"},\"MongoDB-Logo.png\":{\"hash\":\"XXXXXX\",\"url\":\"https:\\/\\/scontent.xx.fbcdn.net\\/v\\/t45.1600-4\\/XXXXXXXX\"}}}">

That would allow you to check for status codes, etc. I was able to grab both the name and hash from the response, so that resolved my immediate issue.

from facebook-ruby-business-sdk.

joephayes avatar joephayes commented on April 20, 2024

Could someone from Facebook weigh in here though? Are there plans to support read after write when creating ad images? Or is it already supported and I did something wrong in my code?

from facebook-ruby-business-sdk.

alanho avatar alanho commented on April 20, 2024

are you trying to get the name of the image from read-after-write? read-after-write is supported in /adimages it's just name of the images will be the key of the hash returned. and the sdk do not extract the key and put it in AdImage object currently

from facebook-ruby-business-sdk.

joephayes avatar joephayes commented on April 20, 2024

@alanho - Thanks for the response and that it what I'm doing. I did realize the name comes back in the response and so I'm using the last_api_response property of the ad account to get at them (see my comment above - #50 (comment))

If this is the case, then what is the use of the fields key when you create ad images? See the example image upload file - https://github.com/facebook/facebook-ruby-business-sdk/blob/master/examples/image_upload.rb

from facebook-ruby-business-sdk.

stale avatar stale commented on April 20, 2024

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

from facebook-ruby-business-sdk.

stale avatar stale commented on April 20, 2024

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

from facebook-ruby-business-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.