GithubHelp home page GithubHelp logo

Comments (5)

JiamingFB avatar JiamingFB commented on April 20, 2024 1

I just applied a patch for it in latest code. Looks like the encoding bug has been there for a while, but seemingly it didn't break the request (server has some level of tolerance) unless the body contains special characters like "&"

If you want to stay in v2.6, you can copy that one-line change :)

from facebook-java-business-sdk.

JiamingFB avatar JiamingFB commented on April 20, 2024

Hi sang-d,

It might be related to json escaping of special characters. Would you mind posting some code snippet of your code?

Also, you can pass an AdCreative object as param instead of a json string, which would better handle the encoding.

Thanks!

from facebook-java-business-sdk.

sang-d avatar sang-d commented on April 20, 2024

hi JiamingFB,
Thanks for quick response. Following is code section to create the ad:

AdCreative creative = new AdCreative(); creative.setFieldTitle(obj.getString("title")); creative.setFieldBody(obj.getString("body")); creative.setFieldLinkUrl(obj.getString("link_url")); creative.setFieldObjectUrl(obj.getString("object_url")); creative.setFieldImageHash(obj.getString("image_hash")); if (obj.has("url_tags")) { creative.setFieldUrlTags(obj.getString("url_tags")); }

BatchRequest batch = new BatchRequest(context); APIRequestCreateAd req = account.createAd().setAdsetId(adsetId).setCreative(creative).setName(variantName) .setStatus(Ad.EnumStatus.VALUE_PAUSED); req.addToBatch(batch);

Thanks,
Sang

from facebook-java-business-sdk.

sang-d avatar sang-d commented on April 20, 2024

hi JiamingFB,

This issue happens only when creating ad in a BATCH request.
I just tried with single request execute, then it works fine.

For eg above, if I set:
creative.setFieldUrlTags("k=1&x=2&y=3");
It will throw error. Or it also happens if i put:
creative.setFieldLinkUrl("http://sdinh.net?k=1&x=2&y=3");

Please take a look.
Thanks
Sang

from facebook-java-business-sdk.

JiamingFB avatar JiamingFB commented on April 20, 2024

Hi sang-d,

Looks like there is a bug in encoding when assembling batch request. The "body" in batch request is supposed to be url-encoded, but it's not encoded right now.

Sorry for the inconvenience. I'll work on the fix.

from facebook-java-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.