Skip to Content
1
Sep 12, 2020 at 05:46 AM

Duplicated keys in OData API response

178 Views

Dear Community,

we are looking to build an integration using the OData API, however we noticed that there are duplicated keys in the response the API returns.
More specifically, we are trying to insert job applications. The above mentioned behavior occurs only if the respective job requisition has been assigned more than one screening questions.

Following is a sample request.

{
    "resume": {
        ... an attachment object
    },
    "jobReqId": 99887766,
    "jobApplicationQuestionResponse": [
        {
            "order": "1",
            "answer": "No"
        },
        {
            "order": "2",
            "answer": "3-5 years"
        }
    ],
    "coverLetter": {
        ... an attachment object
    },
    "candidateId": "44444",
    "appStatusSetItemId": "1234567",
    "appLocale": "en_GB"
}

This is the response we get.

{
    "d": {
        "__metadata": {
            "uri": "<API base URL>/JobApplication(2222L)",
            "type": "SFOData.JobApplication"
        },
        "jobReqId": "99887766",
        "candidateId": "44444",
        "appStatusSetItemId": "1234567",
        "appLocale": "en_GB",
        "applicationId": "2222",
        "resume": {
            ... attachment response
        },
        "jobApplicationQuestionResponse": {
            "__metadata": {
                "uri": "<API Base URL>/JobApplicationQuestionResponse???",
                "type": "SFOData.JobApplicationQuestionResponse"
            },
            "order": "1",
            "answer": "No"
        },
        "jobApplicationQuestionResponse": {
            "__metadata": {
                "uri": "<API base URL>/JobApplicationQuestionResponse???",
                "type": "SFOData.JobApplicationQuestionResponse"
            },
            "order": "2",
            "answer": "3-5 years"
        },
        "coverLetter": {
            ... attachment response
        }
    }
}

The problem is that the library we are using can't handle duplicated keys (see the properties "jobApplicationQuestionResponse" above) in the response.

Has any of you faced this issue? If so, could you please, describe how this can be solved?

Thank you for your input in advance!