Solved

API error - GDC::Exception::NotFound


Hello, please help me.  I tried to get all users in my project over API reguest.  I got error message. What does it mean?

 

 

icon

Best answer by Jan Rehanek 5 May 2022, 11:17

View original

44 replies

Userlevel 3

Hi Petr, 

 

I see you are using the wrong value for “projects”. Please use the workspace/project ID instead of the user ID.

Feel free to check the following article in case you don’t know how to find it: Find the Workspace ID

 

-Moises

Hello, thank you very much.

Now is all right.

 

Please help me agin.

I would like to use API for next points. Please help me, what I can use.

 

  1. UPDATE user filtered variables.  For example, I would like to change value for variables ident for user (me) . How can do it over API.  (I need only name of API)

 

  1.  ADD OR REMOVE user into usergroup  I would like to add new user into group A. How can do it over API.

           (I need only name of API)

 

Thank you very much

 

 

 

 

Userlevel 3

You can find the information on our API library at the following: 

 

https://help.gooddata.com/doc/enterprise/en/expand-your-gooddata-platform/api-reference#operation/updateVariable

Hello, thank you for informations.

   1.  I tried find ID variable for update. I follow the instructions step by step

 

2.

I did not get list of values like example :   

 

I don't know where is relation into user.

  1. I did not get answer about my second question. “ADD OR REMOVE user into usergroup  I would like to add new user into group A. How can do it over API.”

 

Thank you for help.

 

 

 

Userlevel 3

The body for updating a variable should look as follows: 

 

{

  • "variable":[
    • {
      • "related": "http://example.com",

      • "level": "user",

      • "expression": "string",

      • "type": "filter",

      • "uri": "/gdc/md/{project_id}/variables/item/{variable_value_1_id}",

      • "prompt": "/gdc/md/{project_id}/obj/{variable_id}",

      • "tree":{
        • "type": "string",

        • "value": "string",

        • "position":{
          • "line": 0,

          • "column": 0

          },
        • "content":{
          • "type": "string",

          • "value": "string",

          • "position":{
            • "line": 0,

            • "column": 0

            },
          • "content": { }

          }
        }
      }
    ]

}

 

I apologize for missing the second part of the question. This can also be found in the API library: 

 

https://help.gooddata.com/doc/enterprise/en/expand-your-gooddata-platform/api-reference#operation/modifyUserGroupMembers

 

The values for those operations are either SET, ADD, or Remove.

Hello, thank you for informations.

 tried find ID variable for update and I got answer. Moved Permanently. I din not get list of variables.  

What I have to change for right result ?

 

 

 

For example :

 

 

 

Userlevel 3

You will need to execute a GET to find metadata objects of the prompts category.

 

 

GET<Domain>/gdc/md/{project_id}/objects/query

 

{

  • "objects":{
    • "paging":{
      • "offset": 0,

      • "count": 1

      },
    • "items":[
      • {
        • "analyticalDashboard":{
          • "meta":{
            • "title": "Some title",

            • "category": "metadataType",

            • "tags": "tag1 tag2",

            • "author": "/gdc/account/profile/p123",

            • "created": "2020-01-08 15:44:23",

            • "contributor": "/gdc/account/profile/p123",

            • "updated": "2020-01-08 15:44:23",

            • "identifier": "identifier123",

            • "flags":[
              • "string"

              ],
            • "summary": "Object summary",

            • "uri": "string",

            • "deprecated": "0",

            • "locked": 0,

            • "unlisted": 0,

            • "isProduction": 0,

            • "sharedWithSomeone": 0

            },
          • "content":{ }
          }
        }
      ],
    • "forbidden":[
      • "/gdc/md/{project_id}/obj/{variable_id}"

      ]
    }

}

 

Please , I try call object methods “/objects/query” with required parameters limit and category and I got error answer.

Where is problem ?  Thank you very much.

 

 

 

.

 

 

Userlevel 3

It looks like you are running the wrong url for your GET call. It should look like this: 

 

GET<Domain>/gdc/md/{project_id}/objects/query

OK. 

Now I got this answer. Which category I need use  for user filter variables ?

 

 

Category in documentation:

 

 

For category - “prompts”  is the same error.

 

 

I need help for continue.

Userlevel 3

Could you please provide the full URL you are using to make the call as well as the body of your call?

https://edofinance.on.gooddata.com/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/objects/query?limit=20&category=prompts

Userlevel 3

You need to make the call to the following URL: https://edofinance.on.gooddata.com/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/objects/query

Then you would apply the body of the call into the RAW textbox of your API tool. For example: 

 

 

Userlevel 3

I’m terribly sorry, but it looks like our docs are a bit out of synch. 

 

The categories should be labeled as follows: 

 

“userFilter”

“prompt”

 

We will update our docs accordingly, and apologize for the confusion. Something may have changed recently and we will rectify this. 

Ok. I got response.  I would like find out variables for title “ident_nadr”  for users.

What next ?

 

Response:

 

 

 

 

 

Userlevel 3

It’s not listed in our doc, but once you have the object ID for the Variable, you can then make a call to get a list of users using that specific variable: 

 

POST https://{hostname}/gdc/md/{PID}/variables/search
body:

{    "variablesSearch":    {        "variables":["/gdc/md/z{PID}/obj/prompt_obj_id1","/gdc/md/z{PID}/obj/prompt_obj_id2",...],        "context":["/gdc/account/profile/user_id1","/gdc/account/profile/user_id2",...],        "searchOptions":        {            "offset":0,"limit":500        }    }}

 

 

context in this case relates to the profile ID of the user. You can leave this blank and get a list of the user for the specified variable as needed. 

I did it, and I got this response.

Where is problem ?

 

 

 

Userlevel 3

We’ve checked the logs, but it seems like the request you made here never reached us. Could you please try again using https instead of http?

Over https I got answer:  Please, where is problem ?

 

 

Userlevel 3

It looks like you are missing the quotes around “/gdc/md/…..”

I change body and I got answer:

 

 

 

What next ? I would like to get value variable for User.

value “74729675”.

 

 

 

Response:

 

{
"variables": [
{
"uri": "/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/variables/item/6",
"expression": "TRUE",
"prompt": "/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12887",
"related": "/gdc/projects/vqhnjvya515i05v3jawkf740y77j59xh",
"type": "filter",
"tree": {
"type": "true",
"position": {
"line": 1,
"column": 14
}
},
"level": "project"
},
{
"expression": "[/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12524] IN ([/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12524/elements?id=68269])",
"uri": "/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/variables/item/7",
"prompt": "/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12887",
"tree": {
"position": {
"line": 1,
"column": 67
},
"content": [
{
"position": {
"line": 1,
"column": 14
},
"value": "/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12524",
"type": "attribute object"
},
{
"content": [
{
"value": "/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12524/elements?id=68269",
"type": "attributeElement object",
"position": {
"line": 1,
"column": 71
}
}
],
"position": {
"column": 71,
"line": 1
},
"type": "list"
}
],
"type": "in"
},
"type": "filter",
"related": "/gdc/account/profile/86b784c72bb79d0fe11251f881d2574b",
"level": "user"
},
{
"prompt": "/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12887",
"expression": "[/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12524] IN ([/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12524/elements?id=68312])",
"uri": "/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/variables/item/8",
"level": "user",
"type": "filter",
"tree": {
"type": "in",
"position": {
"line": 1,
"column": 67
},
"content": [
{
"value": "/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12524",
"type": "attribute object",
"position": {
"column": 14,
"line": 1
}
},
{
"type": "list",
"position": {
"line": 1,
"column": 71
},
"content": [
{
"value": "/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12524/elements?id=68312",
"type": "attributeElement object",
"position": {
"column": 71,
"line": 1
}
}
]
}
]
},
"related": "/gdc/account/profile/78a9bb9b043434ef87d4ab5d472ac839"
}
]
}
Userlevel 3

Hello Plaube,

We have been taking this one API call at a time, and I think it would be helpful if we knew what your end goal is.

What kind of information would you like to get to? If we could know the solution you are trying to design, it would make it easier for us to take you through it step by step.

Hello,

  1. I would like get all filtered values for all user in project

          Does it mean:  My account has set variable ident_nadr and value : 74729675 

          I need get from API value “74729675” .  I need to know which user it belongs to.

  1. Compare value with local system
  2. Update all differents into Gooddata ( UPDATE,INSERT)  over API.

 

That is all.

Userlevel 3

All right. So, let’s take it step by step.

This has been covered by the previous posts, but to have it all in one place, I will repeat.

 

1/ Getting a list of variables

Method: POST

URL: https://<domain>/gdc/md/<project_id>/variables/search

Body to retrieve unfiltered variables for all users (mind the value of limit in case you are not receiving everything you think you should):

{
"variablesSearch": {
"variables": [],
"context": [],
"searchOptions": {
"offset": 0,
"limit": 500
}
}
}

Body to retrieve variables filtered for a specific variable object (where object_id equals to the id of variable you want to retrieve):

{
"variablesSearch": {
"variables": [
"https://<domain>.on.gooddata.com/gdc/md/<project_id>/obj/<object_id>"
],
"context": [],
"searchOptions": {
"offset": 0,
"limit": 500
}
}
}

The result should be something like this:

{
"variables": [
{
"prompt": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/obj/508",
"type": "scalar",
"expression": "0",
"level": "project",
"related": "/gdc/projects/icbkspun9y7r4rz361y7oblj8o5vz51i",
"uri": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/variables/item/1"
},
{
"expression": "1555555",
"level": "user",
"prompt": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/obj/508",
"type": "scalar",
"uri": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/variables/item/2",
"related": "/gdc/account/profile/b397fc837e65e2bcbd4ad8157a9684bb"
},
{
"uri": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/variables/item/3",
"related": "/gdc/account/profile/d61c6cc59f2c996211f3dc3f1aa9c5be",
"expression": "2555555",
"level": "user",
"type": "scalar",
"prompt": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/obj/508"
},
{
"related": "/gdc/account/profile/864b40fde90d79d53ab369cc9710845e",
"uri": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/variables/item/4",
"type": "scalar",
"prompt": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/obj/508",
"level": "user",
"expression": "1555555"
},
{
"related": "/gdc/account/profile/71819bddf8522b15ef42d4bab6e1484c",
"uri": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/variables/item/5",
"type": "scalar",
"prompt": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/obj/508",
"expression": "4555555",
"level": "user"
}
]
}

What it means:

  • expression = the value of the variable (in your case this would be “74729675” that you are looking for)
  • related = user ID
  • prompt = the variable object
  • type = scalar or filtered (configured while you are creating the variable)
  • level = default for project or user-level when assigned to a specific user

2/ Comparing values with a local system

This really depends on your local system. In broad terms, you would parse the JSON reply from above, compare it with whatever local data you have and formulate the response based on that. It should be consulted with your own internal documentation and any engineers who may be working on it there. The end result should be a JSON body to send with the request described below.

3/ Changing the variable values via API 

Method: POST

URL: https:/<domain>/gdc/md/<project_id>/variables/user

Body to submit with the request:

{
"variables": [
{
"expression": "1555555",
"level": "user",
"prompt": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/obj/508",
"related": "/gdc/account/profile/864b40fde90d79d53ab369cc9710845e",
"type": "scalar",
"uri": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/variables/item/4"
}
]
}

Modify the value of the key “expression” in order to set the variable to a new value. The definition of the various keys is consistent with the explanation I wrote under step 1/.

 

I hope this helps 🙂

Reply