CLI and REST API calls are giving different results for /sourconfig

  • 0
  • 1
  • Problem
  • Updated 2 years ago
  • Solved
I am not getting some values in the API response /resources/json/delphix/sourceconfig?environment=UNIX_HOST_ENVIRONMENT-14 however they were shown when executed in CLI.
When provisioning mysql vdb, db expects unique portno. I wanted to run through all existing ports and pick next port(3312; assuming i have ports from 3308 to 3311) by calling REST API 
API Response: 

CLI Response:
{    "type": "ListResult",
    "status": "OK",
    "result": [
            "type": "MySQLServerConfig",
            "reference": "MYSQL_SERVER_CONFIG-22",
            "namespace": null,
            "name": "/var/tmp/delphix/provision/VNTLS_QA_MYSQL_SRC-FVK/datafile",
            "linkingEnabled": true,
            "discovered": false,
            "environmentUser": "HOST_USER-28",
            "repository": "MYSQL_INSTALL-4",
            "dataDirectory": "/var/tmp/delphix/provision/VNTLS_QA_MYSQL_SRC-FVK/datafile",
            "port": 3308,
            "user": "xxxxx",
            "credentials": {
                "type": "PasswordCredential",
                "password": "***********"
From the above 2 results, portno, user, etc are missing in API. 
We are using DE version. Is this a bug in this version?
Photo of Viswas Patnala

Viswas Patnala

  • 512 Points 500 badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of Neal Stack

Neal Stack, Employee

  • 3,502 Points 3k badge 2x thumb
Official Response
Hi Viswas,

Do you set the current API version in your script? Check what the current version is from the CLI with `/version`.

For example, I have:

#!/bin/bash# Set API version
curl -s -X POST -k --data @- \
    -c ~/cookies.txt -H "Content-Type: application/json" <<EOF
    "type": "APISession",
    "version": {
        "type": "APIVersion",
        "major": 1,
        "minor": 8,
        "micro": 1

# Login
echo -e "\n"
curl -s -X POST -k --data @- \
    -b ~/cookies.txt -H "Content-Type: application/json" <<EOF
    "type": "LoginRequest",
    "username": "delphix_admin",
    "password": "delphix"

# List MySQL sourceconfig
echo -e "\n\nListing MySQL sourceconfig..."
curl -X GET -k \
    -b ~/cookies.txt -H "Content-Type: application/json"

Which results in:

Listing MySQL sourceconfig...

I tested with Delphix 5.1.3 but sometimes not setting the API version correctly produces different results.

Photo of Viswas Patnala

Viswas Patnala

  • 512 Points 500 badge 2x thumb
Hi Neal, Thanks for quick response and resolution. You are correct. We were using old API version in our code. We got all values in the response after updating the version. 
Thanks a bunch!
Photo of Adam Bowen

Adam Bowen, Official Rep

  • 17,884 Points 10k badge 2x thumb
Yep. I would say you are probably setting your version as 1.6.0 in your api session
Photo of Viswas Patnala

Viswas Patnala

  • 512 Points 500 badge 2x thumb
I was using 1.4.3 in my session earlier, now changed to 1.7.0. Is this going to impact my other functionalities or API responses?
Photo of Ranzo Taylor

Ranzo Taylor, Employee

  • 1,666 Points 1k badge 2x thumb
You would definitely need to QA your code after going up in versions.  Delphix supports old versions in API calls so that your code is stable. wouldn't get new API calls, and the output might change as you saw.  

We typically don't retire old API calls, so it's very unlikely that something you're using has "disappeared".

We recommend trying to stay current, but you definitely need to test. A common problem is expecting a certain piece of output to be in "column number 4" and it has moved, or expecting a certain statement to return a certain number of columns in it's response.  Unless your code relies on some tricks like that, you should be OK coming up to the latest.