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 2

Dear @plaube.

I am afraid this thread went beyond what community around GoodData products can provide. It seems it is rather for an implementation package from GoodData.

Best regards.

Martin

Please can you send me answer about my two problems ? I would like to finish this task.

Hello, 

I changed according to the instructions.

1)

 

IF I change “variable” to “variables”

 

  1. ADD adds users to the group using the user IDs from the "items" array:

 

 

The API for add user into usergroup don't  send response.  

 

Please can you send me answer about my two problems TODAY?

 

 

 

Userlevel 3

Hello,

Regarding the userGroups:

POST to <domain>.com/gdc/userGroups/<group_id/modifyMembers

SET deletes and adds users so that the group's membership is exactly as listed in the "items" array:

{
    "modifyMembers": {
        "operation": "SET",
        "items": [
            "/gdc/account/profile/a312d87ff81a2975306688000cfb915a"
        ]
    }
}

ADD adds users to the group using the user IDs from the "items" array:

{
    "modifyMembers": {
        "operation": "ADD",
        "items": [
            "/gdc/account/profile/a312d87ff81a2975306688000cfb915a"
        ]
    }
}

REMOVE removes users from the group using the user IDs from the "items" array:

{
    "modifyMembers": {
        "operation": "REMOVE",
        "items": [
            "/gdc/account/profile/a312d87ff81a2975306688000cfb915a"
        ]
    }
}


Regarding your variable error:

If you are using the "variable" key, the value cannot be an array, but has to be an object instead. Use this:

{
"variable": {
"related": "..."
}
}

NOT

{
"variable": [
{
"related": "..."
}
]
}

 

The API for add user into usergroup don't  send response.  

 

 

Please can you send me answer about my two problems TODAY?

 

 

Hello, I change words “variable” into “variables”. I got the same error.

 

 

Userlevel 2

 

  1. I believe you the error is clear and you need to use “variables” and not “variable” 

 

 

  1. To add a user to a group you can follow the following template for the api: 

 

 

POST:
<Domain>/gdc/userGroups/group_id/modifyMembers

Use parameters: group_id
Content-Type: application/json

Body:

{
"modifyMembers": {
"operation": "SET",
"items": [
"/gdc/userGroups/{group_id}",
"/gdc/account/profile/{profile_id}",
"/gdc/userGroups/{group_id}",
"/gdc/account/profile/{profile_id}"
]
}
}

Hello, I would like to finish this task , please can you send me answer about my two problems ?

Second problem is how add user into user group. I did not find API for this function. Please help me too. Thank you very much.

Hello , now call API project user groups is without problems.  Thank you.

 

Your problem there with the “"'\"' expected, at character offset” error is a trailing comma in the variable object definition.

This is not really related to GoodData as a platform, but concerns JSON syntax. For more information on JSON, I would recommend reading through https://www.json.org/json-en.html and enforcing some sort of syntax validation before sending an API call.

 

I change JSON syntax. I got this error answer.  Please help me. Thank you very much.

 

 

 

 

 

 

 

 

 

 

 

Userlevel 3

Hello,

Your problem there with the “"'\"' expected, at character offset” error is a trailing comma in the variable object definition.

This is not really related to GoodData as a platform, but concerns JSON syntax. For more information on JSON, I would recommend reading through https://www.json.org/json-en.html and enforcing some sort of syntax validation before sending an API call.

 

Edit: For the projects groups, the API is defined under https://help.gooddata.com/doc/enterprise/en/expand-your-gooddata-platform/api-reference#tag/user-groups. Important part is this: 

query Parameters
user

string

Optional user UID filter.

project

string

Project filter. Mandatory in most cases.

 

Query parameter is expected - ?project=<project_id>

Hello, I need continue , please can you send me answer about my problem ?

 

 

I also try to get information about usergroup. I got this error response.

 

 

Documentation:

 

Please, can you get answer where is problem ?

Hello, now it is OK.  Thank you very much.

 

Now, I try create variable for user.

I got this error response.  Please help me.

 

 

 

Userlevel 3

Hello,

If you receive a response of the type “filter”, there are extra steps that need to be taken. We start with this reply from the /variables/search endpoint: 

{
    "variables": [
        {
            "expression": "[/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/obj/446] IN ([/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/obj/446/elements?id=1126])",
            "type": "filter",
            "uri": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/variables/item/13",
            "level": "user",
            "tree": ...,
            "related": "/gdc/account/profile/d61c6cc59f2c996211f3dc3f1aa9c5be",
            "prompt": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/obj/510"
        }
        ...
    ]
}

To retrieve the value of the variable which is of type filter, first you must retrieve the attributeDisplayForm ID. Use the first part of the "expression" value and submit a GET request. In my example, this will be to the following address:  https://<domain>/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/obj/446

From there, you should retrieve the object ID from "attribute"/"content"/"displayForms"[index]/"links"/"elements":

{
    "attribute": {
        "content": {
            "displayForms": [
                {
                    "links": {
                        "elements": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/obj/447/elements"
                    },
            ...
    }
}

The ID of the attributeDisplayForm in my example is 447.

Then we take second link from the "expression" value and adjust it from /gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/obj/446/elements?id=1126 to /gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/obj/447/elements?id=1126 and submit a GET request to this address. Be sure to adjust the links so that they fit your unique workspace identifiers and object IDs. If the steps were performed correctly, you will receive a reply of this type and be able to retrieve the variable value from "attributeElements"/"elements"[index]/"title":

{
    "attributeElements": {
        "elements": [
            {
                "title": "10065",
                "uri": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/obj/446/elements?id=1126"
            }
        ],
        "elementsMeta": {
            "order": "asc",
            "prompt": "",
            "filter": "",
            "attribute": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/obj/446",
            "mode": "includeuris",
            "offset": "0",
            "records": "1",
            "count": 1,
            "attributeDisplayForm": "/gdc/md/icbkspun9y7r4rz361y7oblj8o5vz51i/obj/447"
        },
        "paging": {
            "next": null,
            "count": 1,
            "total": "1",
            "offset": "0"
        }
    }
}

The value is was looking for was the identifier 10065.

In order to do this in large numbers for a large number of attributes and variables, you will need some sort of programmatic solution on your end. It will need to be able to parse the JSON files, retrieve the object IDs, and construct appropriate links to send the GET requests to.

Hope this helps,

Please, can you get answer where is problem ?

Hello, I did it.

 

Response:

{
"variables": [
{
"prompt": "/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/6476",
"expression": "113",
"level": "user",
"type": "scalar",
"related": "/gdc/account/profile/86b784c72bb79d0fe11251f881d2574b",
"uri": "/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/variables/item/2"
},
{
"uri": "/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/variables/item/7",
"prompt": "/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12887",
"expression": "[/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12524] IN ([/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12524/elements?id=68269])",
"level": "user",
"type": "filter",
"tree": {
"position": {
"column": 67,
"line": 1
},
"content": [
{
"position": {
"column": 14,
"line": 1
},
"type": "attribute object",
"value": "/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12524"
},
{
"type": "list",
"position": {
"line": 1,
"column": 71
},
"content": [
{
"position": {
"line": 1,
"column": 71
},
"type": "attributeElement object",
"value": "/gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12524/elements?id=68269"
}
]
}
],
"type": "in"
},
"related": "/gdc/account/profile/86b784c72bb79d0fe11251f881d2574b"
}
]
}

What next ?

I think, that I got the same value object “ /gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12524”

Userlevel 3

I corrected my previous post to reflect the filtering on the variable object - there was an inaccuracy there.

 In order to filter by user, please compose the request like this, where the context value reflects the ID of the profile you are trying to filter for:

{
"variablesSearch": {
"variables": [
],
"context": [
"/gdc/account/profile/d61c6cc59f2c996211f3dc3f1aa9c5be"
],
"searchOptions": {
"offset": 0,
"limit": 500
}
}
}

 

Thank you very much for summary.

Problem is that I get different response, than you show.

  1. First step

 

Response:

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

 

2) Second step. Filter over object. I used this object 

    /gdc/md/vqhnjvya515i05v3jawkf740y77j59xh/obj/12524  Is it right ?

 

  

   I got this answer:

 

 

I don't know where is problem.

 

 

 

 

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 🙂

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

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.

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 2

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

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

 

 

Reply