provision sql database using the api, results in Error "action=Make sure databaseName is not empty and try again."

  • 0
  • 1
  • Problem
  • Updated 4 years ago
  • Solved
Goal

Provision a SQL Server VDB using the REST API

Steps to reproduce

Using the API

Using the api I discover the target group, host and timeflow parameters and then post the following json

{    "container": {
        "group": "GROUP-5",
        "name": "VGenesis_2D8",
        "type": "MSSqlDatabaseContainer"
    },
    "recoveryModel": "SIMPLE",
    "source": {
        "type": "MSSqlVirtualSource"
    },
    "sourceConfig": {
        "databaseName": "VGenesis_2D8",
        "instance": {
            "host": "HOST-10",
            "type": "MSSqlInstanceConfig"
        },
        "repository": "MSSQL_INSTANCE-4",
        "type": "MSSqlSIConfig"
    },
    "timeflowPointParameters": {
        "timeflow": "MSSQL_TIMEFLOW-1",
        "timestamp": "2014-08-12T12:45:13.000Z",
        "type": "TimeflowPointTimestamp"
    },
    "type": "MSSqlProvisionParameters"
}

Result (status 200)

{
    "error": {
        "action": "Make sure databaseName is not empty and try again.",
        "details": "The field databaseName of the database configuration is required.",
        "message": "exception.db.mssqlvdb.vdb.target_db.no_database_name"
    },
    "status": "ERROR"
}

However using the web flash UI and a packet sniffer I see identical post:
{
    "container": {
        "group": "GROUP-5",
        "name": "VGenesis_2D7",
        "type": "MSSqlDatabaseContainer"
    },
    "recoveryModel": "SIMPLE",
    "source": {
        "type": "MSSqlVirtualSource"
    },
    "sourceConfig": {
        "databaseName": "VGenesis_2D7",
        "instance": {
            "host": "HOST-10",
            "type": "MSSqlInstanceConfig"
        },
        "repository": "MSSQL_INSTANCE-4",
        "type": "MSSqlSIConfig"
    },
    "timeflowPointParameters": {
        "timeflow": "MSSQL_TIMEFLOW-1",
        "timestamp": "2014-08-12T12:45:13.000Z",
        "type": "TimeflowPointTimestamp"
    },
    "type": "MSSqlProvisionParameters"
}

Which results in (status 200)
{
    "action": "ACTION-24852",
    "job": "JOB-17776",
    "result": "MSSQL_DB_CONTAINER-1961",
    "status": "OK",
    "type": "OKResult"
}

The only difference between the two are the http headers (perhaps the delphix server is keeping track of the selected source db using the client cookie)

Any ideas?

Also I noted that the status code for an error is 200, might be better to use http semantics and return in the 400/500 range?
Photo of Edward Wilde

Edward Wilde

  • 130 Points 100 badge 2x thumb

Posted 4 years ago

  • 0
  • 1
Photo of Adam Bowen

Adam Bowen, Official Rep

  • 17,418 Points 10k badge 2x thumb
Hey Ed. I am not in front of a lab to test this, but I would file a ticket. It could just be an issue with the rest api on our end. Suppurt will het back to you much quicker than I can. If you get an answer before I can follow up, please post the result here!
Photo of Edward Wilde

Edward Wilde

  • 130 Points 100 badge 2x thumb
Thanks Adam, I'll open a ticket referencing this post and post any resolution here.
Photo of Johnathan Mackenzie

Johnathan Mackenzie, Employee

  • 60 Points
Hi, please can you post your Delphix Engine version, and the Windows/MSSQL versions?
Photo of Edward Wilde

Edward Wilde

  • 130 Points 100 badge 2x thumb
Delphix - 
 
"apiVersion": {
            "major": 1,
            "micro": 2,
            "minor": 2,
            "type": "APIVersion"
        },
        "buildTimestamp": "2013-10-10T17:25:53.000Z",
        "buildTitle": "Delphix Engine 3.2.3.1",
        "buildVersion": {
            "major": 3,
            "micro": 3,
            "minor": 2,
            "patch": 1,
            "type": "VersionInfo"
        },

source - host
{
    "action": null,
    "job": null,
    "result": {
        "addresses": [
            "*****"
        ],
        "connectorAuthenticationKey": null,
        "connectorPort": 0.0,
        "dateAdded": "2013-10-31T13:39:11.753Z",
        "enabled": true,
        "hostConfiguration": {
            "discovered": false,
            "lastRefreshed": null,
            "lastUpdated": null,
            "machine": {
                "memorySize": 0.0,
                "platform": "AMD64",
                "type": "HostMachine"
            },
            "operatingSystem": {
                "distribution": "Windows",
                "kernel": "7601.win7sp1_gdr.130801-1533",
                "name": "Windows",
                "release": "6.1",
                "timezone": "Europe/London,BST+0100",
                "type": "HostOS",
                "version": "Windows Server 2008 R2 Enterprise"
            },
            "type": "HostConfiguration"
        },
        "hostRuntime": {
            "available": false,
            "traceRouteInfo": null,
            "type": "HostRuntime"
        },
        "name": "******",
        "namespace": null,
        "reference": "HOST-5",
        "rsyncPath": null,
        "sshPort": 0,
        "toolkitPath": null,
        "type": "WindowsHost"
    },
    "status": "OK",
    "type": "OKResult"
}
target - host
{
            "addresses": [
                "*******"
            ],
            "connectorAuthenticationKey": "******==",
            "connectorPort": 9100.0,
            "dateAdded": "2013-11-11T11:22:36.791Z",
            "enabled": true,
            "hostConfiguration": {
                "discovered": false,
                "lastRefreshed": null,
                "lastUpdated": null,
                "machine": {
                    "memorySize": 68719009792.0,
                    "platform": "AMD64",
                    "type": "HostMachine"
                },
                "operatingSystem": {
                    "distribution": "Windows",
                    "kernel": "7601.win7sp1_rtm.101119-1850",
                    "name": "Windows",
                    "release": "6.1",
                    "timezone": "Europe/London,BST+0100",
                    "type": "HostOS",
                    "version": "Windows Server 2008 R2 Enterprise"
                },
                "type": "HostConfiguration"
            },
            "hostRuntime": {
                "available": true,
                "traceRouteInfo": {
                    "networkHops": "1     2 ms     3 ms     3 ms  ****",
                    "type": "TracerouteInfo"
                },
                "type": "HostRuntime"
            },
            "name": "*********",
            "namespace": null,
            "reference": "HOST-10",
            "rsyncPath": null,
            "sshPort": 0,
            "toolkitPath": "C:\Program Files\Delphix\DelphixConnector",
            "type": "WindowsHost"
        }


dSource - repository

{
            "environment": "WINDOWS_HOST_ENVIRONMENT-5",
            "installationPath": "c:\Program files\100",
            "instanceName": "MSSQLSERVER",
            "instanceOwner": "***\SQLService",
            "internalVersion": "661",
            "linkingEnabled": true,
            "name": "MSSQLSERVER",
            "namespace": null,
            "port": 1433,
            "provisioningEnabled": true,
            "reference": "MSSQL_INSTANCE-2",
            "serverName": "*****",
            "staging": false,
            "type": "MSSqlInstance",
            "version": "10.52.4000.0"
 }

vDatabase - repository

{
            "environment": "WINDOWS_HOST_ENVIRONMENT-13",
            "installationPath": "C:\Program Files\Microsoft SQL Server\100",
            "instanceName": "MSSQLSERVER",
            "instanceOwner": "***\delphixservice",
            "internalVersion": "661",
            "linkingEnabled": true,
            "name": "MSSQLSERVER",
            "namespace": null,
            "port": 1433,
            "provisioningEnabled": true,
            "reference": "MSSQL_INSTANCE-4",
            "serverName": null,
            "staging": false,
            "type": "MSSqlInstance",
            "version": "10.50.1600.1"
        }
(Edited)
Photo of Scott MacDonald

Scott MacDonald, Support Engineer

  • 2,332 Points 2k badge 2x thumb
The JSON being used is fine, and works for me submitted using curl (with references changed for my Delphix Engine), as well as one of my colleagues. There seems to be some issue with the method of submission, which we are investigating via a support ticket, but I will also update this topic when appropriate.
Photo of Adam Bowen

Adam Bowen, Official Rep

  • 17,418 Points 10k badge 2x thumb
POST vs GET?
Photo of Scott MacDonald

Scott MacDonald, Support Engineer

  • 2,332 Points 2k badge 2x thumb
The cause of that error has turned out to be due to the APIVersion being used. The failure happens for 1.1.0, but works fine using 1.2.2, and I get the same error if I retry using that 1.1.0 version, so it's a schema change problem.
Photo of Adam Bowen

Adam Bowen, Official Rep

  • 17,418 Points 10k badge 2x thumb
thanks Scott. That is where I was originally guessing the issue was.
Photo of Edward Wilde

Edward Wilde

  • 130 Points 100 badge 2x thumb
Thanks for the help guys
Photo of Avindra Goolcharan

Avindra Goolcharan

  • 404 Points 250 badge 2x thumb
I encountered a similar issue... just following the documentation, we'll tend to use 1.1.0. It would be helpful to others to explain API versions in the beginning of the document.
Photo of Jaclyn Schoof

Jaclyn Schoof, Community Manager

  • 5,092 Points 5k badge 2x thumb
Avindra,
That is a great point, we will fix our documentation to make this more clear moving forward!