0
1

I have 2 client apps. app 1 (APP1) have set a tag named idtag with values ["idtag1" "idtag2"]. app2 (APP2) have no set any tag. If i use pushwoosh interface, creating a filter idtag(idtag1), and throwing a new pushnotification, it runs fine, APP1 receive the notification, and APP2 don´t. But, when i try do the same, with remote api in java, i´m not able to.

I supouse that i have to add another ".put" in this piece of oficial code from sample in java (i get it from oficial documentation link text

 JSONArray notificationsArray = new JSONArray()
            .put(new JSONObject().put("send_date", "now")
                                 .put("content", "test")
                                 .put("link", "http://pushwoosh.com/"));

I supouse too, that i have to add a "conditions" and a condition like the filter, something like ["idtag", "EQ", "idtag1"]... but i try everything and i´m not able to get a result... always get an "status_code":210,"status_message":"Can t parse expression"

Could someone add the lines that is needed to get what i get with the filter and pushwoosh interface?

Thanks in advance and excuse my bad english

asked 31 May '14, 18:56
NCompetition's gravatar image

NCompetition
214

Hello,

Here's the example code with the "conditions" section:

 public static void main(String[] args) throws JSONException, MalformedURLException
{
    String method = "createMessage";
    URL url = new URL(PUSHWOOSH_SERVICE_BASE_URL + method);


    // PUT YOUR conditions here
    JSONArray conditions = new JSONArray()
            .put(new JSONArray()
                    .put("idtag")
                    .put("EQ")
                    .put("idtag1"));

    JSONArray notificationsArray = new JSONArray()
            .put(new JSONObject().put("send_date", "now")
                    .put("content", "test")
                    .put("link", "http://pushwoosh.com/")
                    .put("conditions", conditions));

    JSONObject requestObject = new JSONObject()
            .put("application", APPLICATION_CODE)
            .put("auth", AUTH_TOKEN)
            .put("notifications", notificationsArray);

    JSONObject mainRequest = new JSONObject().put("request", requestObject);
    System.out.println("Request is: " + requestObject.toString());
    JSONObject response = SendServerRequest.sendJSONRequest(url, mainRequest.toString());

    System.out.println("Response is: " + response);
}

Could you please try to test it and let us know about the results?

permanent link
answered 09 Jun '14, 09:34
Dmitry%20%20Dyudeev's gravatar image

Dmitry Dyudeev
3.7k7

Now, this runs for me ;-) Thanks you!!!

(09 Jun '14, 09:40) NCompetition NCompetition's gravatar image

Hello. Can you help me, please? I have a same dude, but in PHP. I have this:

pwCall('createMessage', [ 'application' => PW_APPLICATION, 'auth' => PW_AUTH, 'conditions' => [['IsMember', 'EQ', 'no']], 'notifications' => [ [ 'send_date' => 'now', 'content' => 'test', 'data' => ['custom' => 'json data'], 'link' => 'http://pushwoosh.com/' ] ] ] );

But that is not working, I dont found answer in the appi guide. Any body can help me about, please.

(09 Sep '14, 01:59) c_sinuhe c_sinuhe's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×446
×120
×64
×15

question asked: 31 May '14, 18:56

question was seen: 1,301 times

last updated: 09 Sep '14, 01:59