Cloud Pak for Data

 View Only
Expand all | Collapse all

Export/import users through cpd-cli cmd from 2 differents versions of CP4D

  • 1.  Export/import users through cpd-cli cmd from 2 differents versions of CP4D

    Posted Mon April 03, 2023 09:03 AM

    Hi there, i did a CP4D users export from a 4.0.2 and try to import to a 4.6.2 and i got an error (code 400). I have the same error with group command.
    The export is clearly readable in the json and if try to export somebody from both platform, json format looks the same. Thanks for help.
    export
    [root@cpd-cli-linux-EE-10.0.3-16]# ./cpd-cli user-mgmt get-user ijpe9110 --profile ${CPD_PROFILE_NAME} --output=json >user-ijpe9110.json
    import
    [root@cpd-cli-linux-EE-12.0.2-39]# ./cpd-cli user-mgmt upsert-user --data user-ijpe9110.json --profile ${CPD_PROFILE_NAME}
    [ERROR] 2023-03-31T15:31:19.169368Z Upsert user - Error adding user UpsertUser - Error adding user Received status code: 400, message: Request validation failed: Parameter (body) failed schema validation
    [ERROR] 2023-03-31T15:31:19.171011Z RunPluginCommand:Execution error: exit status 1



    ------------------------------
    Gilles Geraud
    ------------------------------


  • 2.  RE: Export/import users through cpd-cli cmd from 2 differents versions of CP4D

    Posted Thu April 06, 2023 01:47 AM
    Edited by Rahul Shinge Thu April 06, 2023 01:48 AM

    Hi Giles,

    Thank you for your query, there are 2 options,

    1. Use CSV format for export / import.
      1. Export users – use csv format - https://www.ibm.com/docs/en/cloud-paks/cp-data/4.6.x?topic=mgmt-list-users
      2. Import users – use csv from export command (Remove unwanted users) - https://www.ibm.com/docs/en/cloud-paks/cp-data/4.6.x?topic=mgmt-bulk-upsert-users
    2. Use JSON format to fetch and create user (with crafted JSON - due to difference in API signature JSON from get-user can't be used as-is with upsert-user) .
      1. Get single user – use JSON - https://www.ibm.com/docs/en/cloud-paks/cp-data/4.6.x?topic=mgmt-get-user
      2. Create single user – Craft JSON using data from get user command data - https://www.ibm.com/docs/en/cloud-paks/cp-data/4.6.x?topic=mgmt-upsert-user





    ------------------------------
    Rahul Shinge
    IBM
    SAN JOSE CA
    ------------------------------