Avalara Developer Network Developer

ModelRequiredException

Summary

You called an API that requires an object, but you did not provide an object.

Example

{
  "code": "ModelRequiredException",
  "target": "Unknown",
  "details": [
    {
      "code": "ModelRequiredException",
      "number": 38,
      "message": "A required model was not provided.",
      "description": "Please verify that your request included a request body in valid JSON format.",
      "faultCode": "Client",
      "helpLink": "http://developer.avalara.com/avatax/errors/ModelRequiredException",
      "severity": "Exception"
    }
  ]
}

Explanation

This error indicates that you failed to provide a Request Body with your API call.

An HTTP request looks like this:

POST /api/v2/transactions/create HTTP/1.1
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Content-Type: application/json
Content-Length: 23

{
  "name": "value"
}

In this case, each element has a specific meaning:

  • POST is an HTTP verb indicating the type of the request.
  • /api/v2/transactions/create is the name of the API you are calling.
  • Authorization, Content-Type and Content-Length are request headers.
  • The element within the squiggly brackets is called the Request Body.

If you are seeing this error message, it indicates that you failed to pass in a request body, or the request body was not recognized. For more information, please visit the documentation for your API endpoint and look closely at the expected object structure.

Common troubleshooting:

  • Try making your request via Postman, CURL, or our online Swagger API reference. Examine closely how each one works and see whether you are providing the same request body in your code.
  • In the AvaTax REST API, you must provide data in JSON format. Did you provide the object in JSON format?
  • In JSON, you must provide arrays using the square brackets [ ] and you must provide objects using curly brackets { }. Did you use the correct brackets?
  • Compare your data against the example API object documented in swagger. Do you see any differences between the object you uploaded and the example?