shareCardWithPerson [Invalid type: expected NUMBER. (Expected non-null value)]

NateBI
NateBI Contributor
edited February 28 in APIs & Domo Developer

POSTMAN:

ACCESS_TOKEN obtained:

POST: https://api.domo.com/oauth/token
data = {
"grant_type": "client_credentials",
"scope": "data" # "data dashboard workflow user"
}, auth = {CLIENT_ID,CLIENT_SECRET}


CodeEngine Called:

POST:
url: https://company.domo.com/api/codeengine/v2/packages/35233147-8c17-420d-8f48-2754ae6108ea/versions/3.0.1/functions/shareCardWithPerson
headers = {
"X-DOMO-Developer-Token": access_token,
"Content-Type": "application/json"
} body = {
"inputVariables": {
"person": 994139312,
"card_id": 908077640
},
"settings": { "getLogs": true
}
}

Error:

{
"status": 401,
"statusReason": "Unauthorized",
"path": "/api/codeengine/v2/packages/35233147-8c17-420d-8f48-2754ae6108ea/versions/3.0.1/functions/shareCardWithPerson",
"message": "Full authentication is required to access this resource",
"toe": "REDACTED"
}

I have used the sendEmail function just fine simply using the access_token generated from Domo admin. This token didn't work so I read I needed to generate one using the method explained above, however this also hasn't worked.

Tagged:

Best Answer

  • NateBI
    NateBI Contributor
    Answer ✓

    [MAD LAUGHING] It was the cardId variable incorrectly spelt.

Answers

  • NateBI
    NateBI Contributor
    edited February 28

    Watched this:
    https://www.youtube.com/watch?v=Qy0aXeJWSlI

    Testing with original access key but in the headers not bearer token.

    new error message:

    {
    "status": 400,
    "statusReason": "Bad Request",
    "message": "The following input values are invalid: [Invalid type: expected NUMBER. (Expected non-null value)]",
    "toe": "1RG8QZY4X2-12V69-681TW"

    real values removed but this is the body:

    {
    "inputVariables": {
    "person": 000000,
    "card_id": 0000000
    },
    "settings": { "getLogs": true
    }
    }

    I've also tried a list input for person and a string input for card_id based on error message.

    Original js function:
    /**
    * Shares a card with a specific person
    *
    * @param {Person} person - The person
    * @param {text} cardId - The ID of the card
    * @returns {boolean}
    */
    function shareCardWithPerson(person, cardId) {
    return shareResource('badge', cardId, 'user', person);
    }
  • NateBI
    NateBI Contributor
    Answer ✓

    [MAD LAUGHING] It was the cardId variable incorrectly spelt.