AWS IoT Jobs v1.5.1
Client library for AWS IoT Jobs
 
Loading...
Searching...
No Matches
Jobs_GetJobId
size_t Jobs_GetJobId( const char * message,
size_t messageLength,
const char ** jobId );
size_t Jobs_GetJobId(const char *message, size_t messageLength, const char **jobId)
Retrieves the job ID from a given message (if applicable)
Definition: jobs.c:900

Retrieves the job ID from a given message (if applicable)

Parameters
message[In] A JSON formatted message
messageLength[In] The length of the message
jobId[Out] The job ID
Returns
size_t The job ID length

Example

// The following example shows the usage of the Jobs_GetJobId API to
// extract the jobId and its length from a message, if present.
const char * message; // A JSON formatted message from the IoT core
size_t messageLength; // Length of the JSON formatted message
const char * jobId; // variable to hold jobId
size_t jobIdLength = 0U; // Holds length of the jobId
jobIdLength = Jobs_GetJobId( message,
messageLength,
&jobId);
if ( jobIdLength > 0 )
{
// Job ID was successfully extracted from the message
// Store the Job ID so that it can be used as needed by other functions.
// For example, as an input to Jobs_Update.
}