TOPIC:

API call 1 year 3 months ago #244070

  • SHADOWSKY
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 38
  • Thanks: 0

TheMuffinMan wrote: Ok, looks like there is a bug when parsing the pieces code (one of the CURLOPT values are replaced).

Please download and install the component attached (just install over). It should fix the problem will be available with the next update.

Regards,
Markus


Thanks this brings me one step further... I guess now the other side needs to complete their setup as I get not a good response:
404 error
Not Found · We couldn't find that uri on our server, though it's most certainly not your fault.

No route found for "POST /api/tracking"

Now what I see is that I get a new blanco page with the error on it and not on a page within my website. How to handle this?
Afterwards I will receive a API code... where should I place this one?

thx

Please Log in or Create an account to join the conversation.

Last edit: Post by SHADOWSKY.

API call 1 year 3 months ago #244089

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
Hi,

the url to the service is simply wrong.
I would say you better wait for the API code and everything and most important their docs, which should state what urls to use.

To get rid of the white page, delete the last 2 lines of code.

Regards,
Markus

Please Log in or Create an account to join the conversation.

API call 1 year 3 months ago #244096

  • Topic Author
  • gtgt
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 64
  • Thanks: 1
Dear Markus,

I tried to follow your instructions, but something is wrong. The form is generated, the data sent to admin email and mailbackk email, but the API call fails. Error is:

0 syntax error, unexpected '_ff_traceExit' (T_STRING), expecting ',' or ')'

My code is located in SUBMIT PIECES, in AFTER SUBMIT code box. You can find my code below.

Could you help me what should be wrong? Thanks in advance.

Tamas


My code:

// loading the BreezingForms API, mostly for using ff_getSubmit
$this->execPieceByName('ff_InitLib');

/**
This is an example cURL rest api call from:
tutorialsclass.com/php-rest-api-post-data-using-curl/
*/

// User data to send using HTTP POST method in curl

Echo "Hello world!<br>";

// data taken from the form:

//$data = array('name'=>ff_getSubmit("name"),'salary'=>ff_getSubmit("salary"), 'age' => ff_getSubmit("age"));
$data = array('taxnumber'=>ff_getSubmit("adoszam"), 'login'=>ff_getSubmit("felhasznalo"), 'password' => ff_getSubmit("jlsz"), 'xmlkey' => ff_getSubmit("lrklcs"), 'xmlchange' => ff_getSubmit("csrklcs"));


// Data should be passed as json format
$data_json = json_encode($data);
// echo $data_json

// API URL to send data
// This is not the real address,
$url = ' api.myprogram.com ';

// curl initiate
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));

// SET Method as a POST
curl_setopt($ch, CURLOPT_POST, 1);

// Pass user data in POST command
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

// Execute curl and assign returned data
$response = curl_exec($ch);

// Close curl
curl_close($ch);

// See response if data is posted successfully or any error
// for debugging remove the comments
//print_r ($response);
//exit;

Please Log in or Create an account to join the conversation.

API call 1 year 3 months ago #244100

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
Did you install the component from my reply earlier? (on page 2 of this thread).

With this, I don't get the error anymore, also not with your most recent code.

For future posts, please make sure to send your code using the code-tags, so they format properly.

Regards,
Markus

Please Log in or Create an account to join the conversation.

API call 1 year 3 months ago #244140

  • Topic Author
  • gtgt
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 64
  • Thanks: 1
Well, I forgot it.

But now I installed, and the API call works, but I could not get the response.
With another software and same parameterrs, it works, So the call is OK, the response was sent by the API server.

But I could not print it on the screen.

Please Log in or Create an account to join the conversation.

API call 1 year 3 months ago #244150

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
yes, I didn't get a response either. That's where the API documentation would come into play. I think they expect some authentication values and/or the request data being sent in a specific format.

Using a plain call like this often doesn't work straight and depends on what the API expects, that's why the API documentation is necessary.

Please Log in or Create an account to join the conversation.

Moderators: ForumSupport
Time to create page: 0.054 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!