-
POST /addressLists- HTTP 200
- status: 0, description: Uploaded / Created
- status: 1, description: Mapped
- status: 3, description: CASS Standardized → this status means address list is ready for use in jobs
- status: 9, description: Error
- HTTP 400
- status: 9, description: Invalid input data.
- HTTP 500
- status: 9, description: custom error message related to server error
- HTTP 200
-
POST /documents
- HTTP 200
- status: 0, description: Success
- HTTP 400
- status 9, description: One of the required parameters is missing.
- status: 9, description: Parameter 'file' is must.
- status: 9, description: Only pdf, doc, docx, pub, ppt, pptx, png, jpeg, and odt formats are allowed.
- status: 1, description: Duplicate Document
- status: 2, description: Document Dimensions outside of range
- status: 3, description: custom error message related to PageCountException
- status: 4, description: Could not render document
- status: 5, description: custom error message related to PreflightException
- HTTP 500
- status: 9, description: custom error message related to server error
- HTTP 200
-
POST /jobs
- HTTP 200:
- status: 0, description: Created
- status: 1, description: DocumentId not found
- status: 1, description: Job DocumentId not found
- status: 1, description: Job Address list Id not found
- status 2, description: Address List ID not found
- status 3, description: Document Type cannot Mail Internationally
- status 4, description: Custom error related to document
- status 5, description: Project does not exist
- status 9, description: Address list not valid for selected Product
- status 9, description: Quantity required for selected product
- status 9, description: Custom error related to quantity
- HTTP 400
- status: 9, description: One of the required parameters is missing.
- status: 9, description: Product not authorized for this customer
- status: 9, description: Return address Name OR Return address Organization is required for selected product.
- status: 9, description: Endorsements not valid for selected product
- status: 9, description: Return Address not valid for selected product
- status: 9, description: Minimum Quantity for selected product is <X>
- status: 9, description: Maximum Quantity for selected product is <X>
- status: 9, description: Custom error related to enclosures
- status: 9, description: Future date greater than <mailingMaxDays> days
- status: 9, description: Mailing date should be greater than current date.
- HTTP 500:
- status: 9, description: custom error message related to server error
- status: 9, description: Could not parse date. Please add mailingDate parameter in form 'yyyymmdd'.
- HTTP 200:
-
POST /jobs/submit
- HTTP 200
- status: 0, Success
- status: 1, description: Job ID not found
- status: 2, description: User does not have access to this payment method
- status: 2, description: payment not authorized
- HTTP 400
- status: 9, description: One of the required parameters is missing.
- status: 9, description: Job with Id <X> is in impermissible state
- status: 9, description: Not authenticated
- status: 9, description: Only Credit Card, Invoice, ACH, User Credit, Apple Pay, Google Pay are allowed.
- status: 9, description: Shipping method information required
- status: 9, description: custom error message related to job submission
- HTTP 500:
- status: 9, description: custom error message related to server error
- HTTP 200
Here are some recommendations on how to handle errors:
1. Ideally, an HTTP response code 2XX (200, 201, etc) should mean success. However, notice that the REST API developers did not follow this rule strictly. They used the <status> field in the response to indicate success or failure. So please check for the <status> value.
Generally status 0 means success and 9 means error. Anything in between is informative, but sometimes also indicates the request could not be processed. The <description> field tells what the issue is. Typically, such errors only happen during development while you are trying to figure out the right parameters to pass. It is rare that in production, after things have stabilized, you will get an error in a 2XX response.
2. HTTP response 4XX typically means the request had incorrect parameters. Again, such errors typically only happen during development, Once your code is in production and stable, you should rarely get a 4XX response.
3. Any 5XX error means the problem is on the C2M server side and has nothing to do with your code. Typically you get a 504 (timeout) when our server is down. This should be rare once we have stabilized our AWS infrastructure. If you hit a 504, it is good to retry a few times (maybe every 5 minutes), Our servers are designed to auto restart if they hit an issue. Sometimes, if our server is very loaded, or if you send a huge PDF, you may get a HTTP 524 error. This typically happens after 100 seconds when the proxy server doesn't get a response. In this case, note that the C2M server is quite possibly still processing your request. So if you resend the request it could get duplicated. This situation is best handled by waiting for a period of time (maybe 10 min) and then polling the server to see if it has completed the request. For example, if you had made a request to upload a document, you can check if a document with the name you specified exists and that tells you that the request has completed.
Carly Brown
Comments