Courseiva
Integrating and managing application datamediumMultiple ChoiceObjective-mapped

SNOW-CAD Integrating and managing application data Practice Question

Exhibit

Refer to the exhibit.

Script snippet:
```
var request = new sn_ws.RESTMessageV2();
request.setEndpoint('https://api.example.com/data');
request.setHttpMethod('POST');
request.setRequestHeader('Accept', 'application/json');
request.setRequestBody('{"key":"value"}');
var response = request.execute();
if(response.getStatusCode() != 201){
    gs.error('Error: ' + response.getBody());
}
```

The script above fails with HTTP 400 Bad Request. What is the most likely missing configuration?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

The Content-Type header is not set to application/json

The 400 Bad Request error typically indicates malformed request syntax. A common cause is missing or incorrect Content-Type header. For REST API endpoints expecting JSON payload, the Content-Type header must be set to application/json. Option C is correct because without this header, the server cannot parse the request body and returns 400. Option A is wrong because the HTTP method (POST) is often correct for creating data; PUT would be for updates. Option B is wrong because missing authentication would result in 401 Unauthorized, not 400. Option D is wrong because the Accept header controls response format; setting it to text/plain is not required for JSON requests.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The HTTP method should be PUT instead of POST

    Why it's wrong here

    The method is appropriate, and 400 is not a method error.

  • Missing authentication credentials

    Why it's wrong here

    Missing auth would produce 401, not 400.

  • The Content-Type header is not set to application/json

    Why this is correct

    Without Content-Type, the server cannot parse the request body, resulting in 400.

  • The Accept header should be text/plain

    Why it's wrong here

    Accept header does not affect request parsing.

About these practice questions

One of 481 original SNOW-CAD practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This SNOW-CAD practice question is part of Courseiva's free ServiceNow certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SNOW-CAD exam.