Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
_Johan
Partner - Contributor III
Partner - Contributor III

API call /v1/licenses/assignments/actions/add gives 301 answer

Hi,

I try to add a entitlement with api call /v1/licenses/assignments/actions/add but get a 301 - Permanently Moved in answer my application.

Testing the call in bruno gives even weirder stuff in response:

<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta http-equiv="X-UA-Compatible" content="ie=edge"/><link rel="shortcut icon" type="image/ico" href="/api/v1/brands/active/files/favIcon"/><style>.qmfe__mwc-root {
      height: 100%;
      margin: 0;
    }
    .sr-only {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border-width: 0;
    }</style><script src="/qlik-embed/main.js" data-namespace="QlikMain"></script></head><body class="qmfe__mwc-root"><script type="module">// Devtool should be loaded anywhere except in production, if devtools=true in localstorage.
    const isProdUrl = window.location.host.endsWith(".qlikcloud.com") || window.location.host.endsWith(".qlikcloudgov.com");
    const isSystemTest = window.location.host.startsWith("system-test") || window.location.host.startsWith("sta.");
    if (isProdUrl && !isSystemTest) {
      const region = window.location.host.split(".")[1];
      switch (region) {
        case "us":
        case "eu":
        case "uk":
        case "de":
        case "sg":
        case "ap":
          const dynatrace = window.document.createElement("script");
          dynatrace.setAttribute("type", "text/javascript");
          dynatrace.setAttribute("src", `https://cdn.qlikcloud.com/qmfe/external/dynatrace/${region}/dynatrace-v1.js`);
          dynatrace.setAttribute("crossorigin", "anonymous");
          window.document.head.appendChild(dynatrace);
          break;
      }
    } else if (isProdUrl && isSystemTest) {
      const dynatrace = window.document.createElement("script");
      dynatrace.setAttribute("type", "text/javascript");
      dynatrace.setAttribute("src", `https://cdn.qlikcloud.com/qmfe/external/dynatrace/dynatrace-system-tests-v1.js`);
      dynatrace.setAttribute("crossorigin", "anonymous");
      window.document.head.appendChild(dynatrace);
    }
    // apply feature overrides
    const [{ addInterceptors }, { features }] = await Promise.all([QlikMain.import("@qlik-trial/qmfe-core"), QlikMain.import("@qlik-trial/qmfe-api")]);
    addInterceptors();
    const { data: featureFlags } = await features.getFeatures().catch(() => ({ data: {} }));
    await QlikMain.applyFeatureOverrides(featureFlags);
    // load devtool
    const devtoolEnabled = window.localStorage.getItem("devtools") === "true";
    if (devtoolEnabled && !isProdUrl) {
      await QlikMain.import("@qmfe/devtool");
    }
    // start main qmfe parcel
    const navigation = await QlikMain.import("@qmfe/navigation");
    navigation.mount();</script></body></html>

 

What am I missing?

Kind regards

Johan

Labels (3)
1 Solution

Accepted Solutions
DaveChannon
Employee
Employee

Hi @_Johan 

It's because you have a trailing /. 

POST /api/v1/licenses/assignments/actions/add/ HTTP/1.1

should be

POST /api/v1/licenses/assignments/actions/add HTTP/1.1

That said, I consider this a bug, thank you for sharing!

View solution in original post

6 Replies
alex_colombo
Employee
Employee

Hey @_Johan could you please post your payload and the headers used in the call? I just tried and it works for me, below an example for the payload.

{
   "add": [
       {
           "subject": "auth0|a08D000001KMO3xIAH",
           "type": "professional"
       }
   ]
}

 

_Johan
Partner - Contributor III
Partner - Contributor III
Author

Hi @alex_colombo,

My body looks similar but I try to set basic user instead.

 

{"add": [{"subject": "Cx0QdNJqtW29pRxfG1vu5T7iW","type": "basicUser"}]}

 

I checked in the Qlik console and the subject is the same as what is written there.

 


Kind regards
Johan

alex_colombo
Employee
Employee

I don't have a tenant with basic and full user for replicate the issue. Could you please open the management console, open dev browser tool on network tab, change the entitlement manually, and then inspect the POST call in network tab in order to see how it sent? Maybe you are missing something in the payload.

_Johan
Partner - Contributor III
Partner - Contributor III
Author

Hi @alex_colombo 

I did and it looks the same. It does get a 207 answer which I don't know what it means and why it doesn't get a 200 or 204

 

Kind regards

Johan

DaveChannon
Employee
Employee

Hi @_Johan 

It's because you have a trailing /. 

POST /api/v1/licenses/assignments/actions/add/ HTTP/1.1

should be

POST /api/v1/licenses/assignments/actions/add HTTP/1.1

That said, I consider this a bug, thank you for sharing!

_Johan
Partner - Contributor III
Partner - Contributor III
Author

Hi @DaveChannon 

Thank you! I hoped that it would be something minor and easily fixed.

Kind regards

Johan