Invalid 3Scale Keys

Tagged:

Currently contains 9 posts

Avatar

March 03, 2015 18:10

a1staffing

I am trying to add an attachment to a candidate via PHP REST. I am receiving the error back “Invalid 3Scale Keys”. What does this mean?

When I copy the candidate ID and json encoded data to your test form on http://www.pcrecruiter.net/apidocs_v2, it works correctly.

Avatar

March 03, 2015 18:23

Wayne-PCRecruiter

I have only seen that when keys are not active for an API. There could be a problem with the SessionId.

To start with, could you email me at wayne@mainsequence.net your access-token request url and your sample POST Attachment request url/body.

I would like to generate and look at the session and see if there is a problem there, but that is not exactly data safe for the forum.

Avatar

March 03, 2015 18:34

a1staffing

Just sent it.

Avatar

March 03, 2015 18:36

Wayne-PCRecruiter

Thank you I will take a look at it.

Avatar

March 03, 2015 20:42

a1staffing

Wayne, thanks for the e-mail. I added the base64_encode per your instructions but I still get the same error “Invalid 3Scale Keys”.

Here is my function that prepares and sends the attachment:

public function create_attachment($data, $title) { $url = “{$this→base_url}/candidates/{$this→candidate_id}/attachments”; $html = base64_encode(“<html><body>{$data}</body></html>”); $fields = array( ‘Name’ => $title . ’ – ’ . date(‘Y-m-d’, time()) . ‘.html’, ‘Type’ => ‘HTML’, ‘Data’ => $html, ‘Size’ => strlen($html), ); $result = $this→curl→execute($url, $fields);
  • $result is returning the error *
    }

Am I using any invalid keys? If not, what is causing this error???

Avatar

March 03, 2015 21:12

Wayne-PCRecruiter

If the keys worked for getting the valid session it is not the keys. It is possibly a problem with the post body.

Could we take a look at what is being generated in the request $fields array before you submit the request? It looks like the forum modified your post a bit but this would be the next location to look at.
Could you dump implode(“-”, $fields); somewhere so we could look at the data before you send it into the curl request. I should be able to troubleshoot with that data.

Also, you do not need to submit Size when you are creating the attachment. That value is for display in the program and is generated after we save the file into the system.

Avatar

March 03, 2015 23:14

a1staffing

Wayne, the json_encode of the $fields data was sent as the attachment to the e-mail I sent you before.

Avatar

March 04, 2015 00:48

a1staffing

Wayne, I finally figured it out. Someone REALLY needs to review the API documentation. It wastes a LOT of time when developing with incorrect base documents.

In it it states “class Attachments(AttachmentId: long, Name: string, Description: string, Size: integer, Date: date, Data: string, Type: string = [‘Upload’ or ‘HTML’ or ‘LinkedFile’ or ‘Profile’] {Attachment Type})”

Note the

Model Model Schema

Attachments
class Attachments(AttachmentId: long, Name: string, Description: string, Size: integer, Date: date, Data: string, Type: string = [‘Upload’ or ‘HTML’ or ‘LinkedFile’ or ‘Profile’] {Attachment Type})

It is not “Name”, it is “FileName”. This plus the error we spoke about before where in “class Resume(FileName: string, Resume: date)” Resume’s data type is not date, but rather base64 bytes makes me wonder what other mistakes are lurking out there.

Please have someone review it and fix them.

Avatar

March 04, 2015 14:26

Wayne-PCRecruiter

That document is not the official document for a reason and was sent out and given to people who needed access to develop before those calls were officially released. It has been under review and being patched for some time now as time permits.

Reply to thread