Jump to content


Photo

API create opportunity - FAILURE

API FAILURE opportunity

  • Please log in to reply
5 replies to this topic

#1 tmankartz

tmankartz

    Newbie

  • New Members
  • Pip
  • 8 posts

Posted 15 June 2012 - 11:45 AM


Hey,


we are trying to implement the opportunity functionality in our billing application.
I want to create an opportunity like this example, but i just get an "FAILURE" message without any message or errors.


the $data array:
array(8) {
["name"]=>
string(10) "Testchance"
["closeDate"]=>
string(10) "2012-08-10"
["probability"]=>
int(5)
["description"]=>
string(4) "test"
["amount"]=>
array(2) {
["value"]=>
string(7) "1080.00"
["currency"]=>
array(1) {
["id"]=>
int(3)
}
}
["stage"]=>
array(1) {
["value"]=>
string(13) "Qualification"
}
["source"]=>
array(1) {
["value"]=>
string(8) "Outbound"
}
["account"]=>
array(1) {
["id"]=>
int(1)
}
}


the call:
$response = parent::apiCall('http://zurmo_url/index.php/opportunities/api/create/', 'POST', $headers, array('data' => $data));


the $headers array is correct, because i can get the currencies to get the id for our currency.


Do you have some tipps why it isn't working or what am i doing wrong?


Thanks in advance.
Timo


#2 Ivica

Ivica

    Advanced Member

  • Moderators
  • 565 posts

Posted 15 June 2012 - 11:58 AM

Can you tell me if you tried to run API tests first? To run those tests, you need to setup $testApiUrl is perInstanceTest.php, to something like:
$testApiUrl = 'http://zurmo_url'; (I suppose that you setup web server root to be in app diectory, according to API URI in your post).

If all API tests pass, to debug what is wrong, you need to do folowing:
1. turn on debug ($debugOn = true) on webserver, in config/debug.php file
2. echo response, before decode it. You should be able to get more details about error, and if you still have problems, you can post response here, and I will try to help you further.

#3 tmankartz

tmankartz

    Newbie

  • New Members
  • Pip
  • 8 posts

Posted 15 June 2012 - 04:38 PM

perInstanceTest.php or perInstanceDIST.php in ./app/protected/config ?

thanks
Timo

#4 tmankartz

tmankartz

    Newbie

  • New Members
  • Pip
  • 8 posts

Posted 15 June 2012 - 04:44 PM

Looks like i need more informations, please tell me more about API tests.

thanks
Timo

#5 petewwa

petewwa

    Member

  • Members
  • PipPip
  • 13 posts

Posted 03 July 2013 - 11:50 AM

any furtherer explanation on how to run api tests or directing to relevant documentation would be appreciated  :-)



#6 mledwards

mledwards

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 03 July 2013 - 03:00 PM

The part that's incorrect in the original post is that the URL needs to be "/opportunities/opportunity".







Also tagged with one or more of these keywords: API, FAILURE, opportunity

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users