2

I must use this patch http callout. Is any one has idea?

http://developers.goformz.com/docs/update-an-existing-data-source-1

I get error

"Invalid HTTP method: PATCH"

Exception.

In our project need to use this callout. Is any other way to update the record from salesforce to goformz record?

HttpRequest req= new HttpRequest();
        req.setMethod('PATCH');
        req.setHeader('Content-Type','application/json');
        String username = '[email protected]';
        String password = 'password123'; 
        Blob headerValue = Blob.valueOf(username + ':' + password);
        String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);
        req.setHeader('Authorization', authorizationHeader);
        req.setBody('{"name": "DE-111","fields": {"7f91803f-fed6-41cb-b506-a62d01500de0": { "text": "Test Street1111"  } }}');
        Http http = new Http(); 
        String url = 'https://api.goformz.com/v2/formz/4bc24f7f-bac8-4632-97b6-a640005becb8';
        req.setEndpoint(url);
        HttpResponse res = http.send(req);
4

1 Answer 1

1

Use the below code

req.setHeader('X-HTTP-Method-Override','PATCH');
req.setMethod('POST');
1
  • Could you add some explanations? Commented Jun 29, 2017 at 19:01

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