Field Monitoring
1.0.0
1.0.0
  • Field Monitoring Module Documentation
  • INTRODUCTION
    • Glossary / Terminology
    • FAQ
    • Report an Issue / Contact us
  • PRODUCT / END-USER DOCUMENTATION
    • Overview
      • User roles and permissions (?)
    • Field Monitoring Module Navigation
    • Overall User Interface
    • Settings section
      • Adding and Editing Questions
      • Sites Management
    • Plan section
      • Building the Rationale For the Monitoring Activity
      • Logging Known Issues
      • Prestructuring Field Monitoring Activities
    • Collect section
      • Activities Overview
      • Drafting a Monitoring Activity
      • Checklist / Questionnaire Setup
      • Checklist Review
      • Assigning / Accepting / Rejecting a Visit
      • Data Collection
      • Report Finalization
      • Submission / Completing a Monitoring Activity
    • Analyze section
      • Monitoring Activity
      • Country Overview
    • FMM workflow (?)
  • TECHNICAL DOCUMENTATION
    • Architecture
    • Development Setup
    • Deployment / DevOps
    • Data Model
    • Fixtures and Management Commands
    • Integration with permissions framework
    • API Documentation
      • Error Handling
    • Frontend
      • Module Structure
      • Build Process
Powered by GitBook
On this page
  • General / Non Field Errors
  • Field Errors
  1. TECHNICAL DOCUMENTATION
  2. API Documentation

Error Handling

Original Django Rest Framework has been modified a bit for consistency and extended to include error codes.

Expected http status codes are 404 and 400. 400 response details are presented below:

General / Non Field Errors

A response for a single error would look like the following:

{
    "non_field_errors": [       
        "Error message"    
    ],
        "error_codes": [        
            "invalid"    
    ]
}

Multiple errors can be provided under non_field_errors key, for example.:

{    
    "non_field_errors": [        
        "Error message",        
        "Another error"    
    ],    
    "error_codes": [ 
        "invalid",        
        "invalid"    
    ]
}

Field Errors

Errors, associated with the fields, will be returned as a mapping:

{    
    "email": [        
        "This field is required."
    ],
    "error_codes": {        
        "email": [            
            "required"        
        ]    
    }
}

And of course can contain multiple messages for a single field:

{    
    "field1": [
        "Err1",
        "Err2"
    ],
    "field2": [
        "Err3"
    ],
    "error_codes": {
        "field1": [
            "invalid",
            "invalid"
        ],
        "field2": [
            "invalid"        
        ]    
    }
}

Any exceptions to these rules should be treated as bugs and reported.

PreviousAPI DocumentationNextFrontend

Last updated 5 years ago