2

Presently my message goes out as the top string. I am wondering if one of the two bottom strings will solve my issue of the data not having different values(val1/val2).

Current Data Delivery:

{ "messagetype": "Transaction", "companyname": "c02", "warehousename": "wh2", "dir": "OUT", "date": "2016-02-23 14:48:57.048", "val1": "3", "val2": "3", "tags": [{"category":"Equipment","number":"P02020","quantity":"1"},{"category":"Equipment","number":"P02135","quantity":"1"},{"category":"Equipment","number":"P02137","quantity":"1"},{"category":"Equipment","number":"P02135","quantity":"1"}]}

Option a:

{ "messagetype": "Transaction", "companyname": "c02", "warehousename": "wh2", "dir": "OUT", "date": "2016-02-23 14:48:57.048", "tags": [{"category":"Equipment","number":"P02020","quantity":"1", "val1": "3", "val2": "3"}] { "messagetype": "Transaction", "companyname": "c02", "warehousename": "wh2", "dir": "OUT", "date": "2016-02-23 14:48:57.048", "tags": [{"category":"Equipment","number":"P02137","quantity":"1", "val1": "2", "val2": "2"}] { "messagetype": "Transaction", "companyname": "c02", "warehousename": "wh2", "dir": "OUT", "date": "2016-02-23 14:48:57.048", "tags": [{"category":"Equipment","number":"P02135","quantity":"1", "val1": "1", "val2": "1"}] { "messagetype": "Transaction", "companyname": "c02", "warehousename": "wh2", "dir": "OUT", "date": "2016-02-23 14:48:57.048", "tags": [{"category":"Equipment","number":"P02135","quantity":"1", "val1": "1", "val2": "1"}]

Option b:

{ "messagetype": "Transaction", "companyname": "c02", "warehousename": "wh2", "dir": "OUT", "date": "2016-02-23 14:48:57.048", "tags": [{"category":"Equipment","number":"P02020","quantity":"1", "val1": "3", "val2": “3”},{ "messagetype": "Transaction", "companyname": "c02", "warehousename": "wh2", "dir": "OUT", "date": "2016-02-23 14:48:57.048", "tags": [{"category":"Equipment","number":"P02137","quantity":"1", "val1": "2", "val2": “2”},{ "messagetype": "Transaction", "companyname": "c02", "warehousename": "wh2", "dir": "OUT", "date": "2016-02-23 14:48:57.048", "tags": [{"category":"Equipment","number":"P02135","quantity":"1", "val1": "1", "val2": “1”},{ "messagetype": "Transaction", "companyname": "c02", "warehousename": "wh2", "dir": "OUT", "date": "2016-02-23 14:48:57.048", "tags": [{"category":"Equipment","number":"P02135","quantity":"1", "val1": "1", "val2": "1"}]

Option c:

{ "messagetype": "Transaction", "companyname": "c02", "warehousename": "wh2", "dir": "OUT", "date": "2016-02-23 14:48:57.048", "val1": "3", "val2": “3”, "tags": [{"category":"Equipment","number":"P02020","quantity":"1",}] { "messagetype": "Transaction", "companyname": "c02", "warehousename": "wh2", "dir": "OUT", "date": "2016-02-23 14:48:57.048", "val1": "2", "val2": "2", "tags": [{"category":"Equipment","number":"P02137","quantity":"1"}] { "messagetype": "Transaction", "companyname": "c02", "warehousename": "wh2", "dir": "OUT", "date": "2016-02-23 14:48:57.048", "val1": "1", "val2": "1", "tags": [{"category":"Equipment","number":"P02135","quantity":"1"}] { "messagetype": "Transaction", "companyname": "c02", "warehousename": "wh2", "dir": "OUT", "date": "2016-02-23 14:48:57.048", "val1": "1", "val2": "1", "tags": [{"category":"Equipment","number":"P02135","quantity":"1"}]


if(isset($_POST['DONE']) === true){
    echo "Submitting";
    $dataString = "val1=" . $_POST['val1'] . ",val2=" . $_POST['val2'];
// set post fields
$post = [
'submit' => 'true',
'activity_name' => 'DataSendOff',
'params'   => [
    'Data' => $dataAsAString
]
];
}
7
  • Please don't bother editing the messages above, they are not code but raw data. It is important that it stays the same so people understand how the string goes out. I just want to know if I changed my outgoing message to one of the below options if it would allow multiple val1 and val2 to be attached to each equipment/quantity. Commented Feb 24, 2016 at 16:55
  • 1
    It definitely looks like json to me.... Commented Feb 24, 2016 at 16:59
  • 1
    Also - why aren't you using json_encode() ? Commented Feb 24, 2016 at 17:01
  • @OliverQueen Yes the string itself is JSON but the form submitting the information is HTML&PHP. I've tried attaching the val1/val2 to the same tag that the Equipment and quantity come through on but it won't send them out that way, or at all. Commented Feb 24, 2016 at 17:02
  • 1
    I guess what I meant to say is, why are you trying to send JSON as a string inside a JSON response? Why not just send it all as response JSON? Commented Feb 24, 2016 at 17:03

1 Answer 1

0

This was solved by iterating through and appending to the 'Equipment' tag. The API dev's had to fix something on their end as well.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.