Interface for invoking Salesforce.com REST calls over SSL with OAUTH authentication. This interface is designed to simplify the interaction between mbed devices and salesforce.com web services.
Dependencies: HTTPClient-SSL MbedJSONValue
Diff: SalesforceInterface.cpp
- Revision:
- 22:3363752cd523
- Parent:
- 21:e5a4471a46fb
diff -r e5a4471a46fb -r 3363752cd523 SalesforceInterface.cpp --- a/SalesforceInterface.cpp Fri Sep 26 03:42:20 2014 +0000 +++ b/SalesforceInterface.cpp Fri Sep 26 04:34:33 2014 +0000 @@ -847,4 +847,19 @@ int SalesforceInterface::min(int value1,int value2) { if (value1 < value2) return value1; return value2; + } + + // look for a specific key value pair in a json message + bool SalesforceInterface::contains(char *json,char *key,char *value) { + bool has_it = false; + + if (json != NULL && key != NULL && value != NULL) { + // parse the json and look for a specific <key,value> pair... + MbedJSONValue parsed; + parse(parsed,json); + char *answer = (char *)parsed[key].get<std::string>().c_str(); + if (strcmp(answer,value) == 0) has_it = true; + } + + return has_it; } \ No newline at end of file