Closed drupol closed 11 years ago
After a night of struggling with the library, I'm still not able to create a candidate. According to the documentation, page 65-66, it should work.
Here is my script:
$taleo = new Taleo($user, $password, $company); $taleo->loglevel(\Monolog\Logger::DEBUG, 'php://stdout'); $taleo->login(); // Create a candidate $response = $taleo->post( 'object/candidate', array( 'candidate' => array( 'city' => 'Toontown', 'country' => 'Be', 'resumeText' => 'This is just a test using new TALEO API.', 'email' => 'drupol@about.me', 'firstName' => 'Pol', 'lastName' => "Dell'Aiera", 'status' => 2, 'middleInitial' => 'P', 'cellPhone' => '0123456789', 'source' => 'Taleo PHP Library', ) ) );
Here is the log:
pol@x201 ~/git/Taleo $ php demo.php [2012-12-03 2:50:34] Taleo.INFO: Setting logfile to: php://stdout [] [] [2012-12-03 2:50:34] Taleo.INFO: Setting log level to: 100(DEBUG) [] [] [2012-12-03 2:50:34] Taleo.INFO: Request GET: https://tbe.taleo.net/MANAGER/dispatcher/api/v1/serviceUrl/XXXXXXX [] [] [2012-12-03 2:50:35] Taleo.DEBUG: Response: {"response":{"URL":"https://ch.tbe.taleo.net/CH04/ats/api/v1/"},"status":{"detail":{},"success":true}} [] [] [2012-12-03 2:50:35] Taleo.INFO: Using Taleo API Version: v1 [] [] [2012-12-03 2:50:35] Taleo.INFO: Host url set to : https://ch.tbe.taleo.net/CH04/ats/api/v1/ [] [] [2012-12-03 2:50:35] Taleo.INFO: Request POST: https://ch.tbe.taleo.net/CH04/ats/api/v1/login {"userName":"*******","password":"*******","orgCode":"*******"} [] [2012-12-03 2:50:36] Taleo.DEBUG: Response: {"response":{"authToken":"webapi2-726628998737XXXXXXX"},"status":{"detail":{},"success":true}} [] [] [2012-12-03 2:50:36] Taleo.INFO: Token file is too old or unavailable. Creating a new one. [] [] [2012-12-03 2:50:36] Taleo.INFO: Temporary token file: /tmp/Taleo-6PR9yJ [] [] [2012-12-03 2:50:36] Taleo.INFO: Login successful. ["webapi2-726628998737XXXXXXX"] [] [2012-12-03 2:50:36] Taleo.INFO: Request POST: https://ch.tbe.taleo.net/CH04/ats/api/v1/object/candidate {"candidate":{"city":"Toontown","country":"Be","resumeText":"This is just a test using new TALEO API.","email":"drupol@about.me","firstName":"Pol","lastName":"Dell'Aiera","status":2,"middleInitial":"P","cellPhone":"0123456789","source":"Taleo PHP Library"}} [] [2012-12-03 2:50:36] Taleo.ALERT: Error 500 {"operation":"internal","errormessage":"Content that does not conform to JSON/XML syntax as per specification","error":"Could not read JSON: Unexpected character ('c' (code 99)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')n at [Source: com.rf.common.util.servlet.RequestResponseRestLoggingFilter$BufferedServletInputStream@30a391c3; line: 1, column: 2]; nested exception is org.codehaus.jackson.JsonParseException: Unexpected character ('c' (code 99)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')n at [Source: com.rf.common.util.servlet.RequestResponseRestLoggingFilter$BufferedServletInputStream@30a391c3; line: 1, column: 2]","errorcode":"500"} []
This question is also posted on TaleoExchange: http://knowledgeexchange.taleo.com/thread/9567
Problem fixed!
After a night of struggling with the library, I'm still not able to create a candidate. According to the documentation, page 65-66, it should work.
Here is my script:
Here is the log: