This repository was archived by the owner on Sep 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
Point in time restore call fails with status code 422 - unprocessable_entity #94
Copy link
Copy link
Open
Description
Hi,
At the outset, thank you for such a great client. Clients make interacting with APIs so seamless and quick.
Problem
A few days ago, I was using this client in order to do a point in time restore of a managed DB on our account. Here is the API documentation for that particular call.
My request looked like this:
var restoreDBRequest = new DatabaseBackup
{
Name = "db-restored-from-API",
Engine = "pg",
Version = "10",
Size = "db-s-1vcpu-2gb",
Region = "blr1",
NumNodes = 2,
Tags = new List<string>(),
BackupRestore = new DatabaseBackupRestore
{
DatabaseName = "existing-db",
CreatedAt = new DateTime(2021, 02, 20, 16, 45, 0)
}
};Which constantly threw the error with a status code 422:
{"message":"invalid json body","id":"unprocessable_entity","request_id":"XXXXX"}Using this information, I contacted digital ocean's support for a resolution and after much back and forth it has been solved. As per them
- The name of the restored db cannot contain capital letters.
- The timestamp should be in ISO8601 format.
I made these 2 changes and executed the request:
var restoreDBRequest = new DatabaseBackup
{
- Name = "db-restored-from-API",
+ Name = "db-restored-from-api",
Engine = "pg",
Version = "10",
Size = "db-s-1vcpu-2gb",
Region = "blr1",
NumNodes = 2,
Tags = new List<string>(),
BackupRestore = new DatabaseBackupRestore
{
DatabaseName = "existing-db",
- CreatedAt = new DateTime(2021, 02, 20, 16, 45, 0)
+ CreatedAt = new DateTime(2021, 02, 20, 16, 45, 0, DateTimeKind.Local)
}
};And I was successfully able to restore my DB to the point in time that I wanted.
Issue
- Do you think it makes sense to run a
.ToLower()on theDatabaseBackup.Namefield? - Do you think it makes sense to throw an exception if the
Kindproperty ofDatabaseBackupRestore.CreatedAtisUnspecified?
Metadata
Metadata
Assignees
Labels
No labels