0

This is essentially part 2 building from my earlier question. Call Restful SFDC service from Java

I successfully got my service to authenticate. I also got my service to successfully call a post when the method has no parameters. When I try to add parameters to my restful service I get an error returned.

@RestResource (urlMapping='/CaseCreate/*')
global with sharing class FileNetRest
{
    @HttpPost
    global static String createCase(String pCode)
    {
        return 'success2';
    }
}

enter image description here

When I make this call, I get an error:

[
    {
        "message": "Unexpected character ('-' (code 45)) in numeric value: expected digit (0-9) to follow minus sign, for valid numeric value at [line:1, column:3]",
        "errorCode": "JSON_PARSER_ERROR"
    }
]
5
  • Try Content-Type of x-www-form-urlencoded and use the x-www-form-urlencoded button. (What you tell the recipient you are sending and the format you send need to match.)
    – Keith C
    Jul 28, 2014 at 14:48
  • @KeithC I get an unsupported media type error when I do that.
    – dphil
    Jul 28, 2014 at 15:16
  • OK. So how about Content-Type of application/json and use the raw button to just post {"pCode": "testing"} JSON?
    – Keith C
    Jul 28, 2014 at 15:47
  • @KeithC Perfect! If you would like to place that in an answer I can accept it.
    – dphil
    Jul 28, 2014 at 15:51
  • Just as well I was running out of guesses...
    – Keith C
    Jul 28, 2014 at 15:55

1 Answer 1

3

So how about Content-Type of application/json and use the raw button to just post {"pCode": "testing"} JSON?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .