REST API GetUser Problem

Question / Problem

Hello, I am trying to fetch a Kintone user’s user code.

What am I doing wrong?

Thank you in advance for helping

Code / Attempts

Example for Records.http

### kintone REST API Requests - App Records

@domain = // Kintone Subdomain
@appId = // App ID
@apiToken1 = // API Token
@apiToken2 = // API Token

@userCode = Administrator

### GET / records
GET https://{{domain}}/k/v1/records.json?app={{appId}}
X-Cybozu-API-Token: {{apiToken1}}

### POST / records
POST https://{{domain}}/k/v1/records.json
X-Cybozu-API-Token: {{apiToken1}}, {{apiToken2}}
Content-Type: application/json

{
  "app" : {{appId}},
  "records": [
    {
      "Company_Name_Search": {
        "value": "Kintone"
      },
      "Deal_Name": {
        "value": "Kintone app creation"
      },
      "Rep": {
        "value": [{"code": "{{Administrator}}"}]
      }
    },
    {
      "Company_Name_Search": {
        "value": "Cybozu"
      },
      "Deal_Name": {
        "value": "Kintone JavaScript customization"
      },
      "Rep": {
        "value": [{"code": "{{Administrator}}"}]
      }
    }
  ]
}

Error Message

Desired Outcome / Expected Behavior

I want to get the information of this Kintone account:

Screenshot of the console log when running kintone.getLoginUser();:

Referenced Resources

I am following the Kintone Technical Training - REST API - YouTube tutorial but stuck on this step.

Hello @Jayron_Rosel ,

You should not be replacing {{userCode}} with {{Administrator}} since it is a variable name set on line 6.

This code should work after replacing the variables with your information:

Variables to update:

  • @domain
  • @appId
  • @apiToken1
  • @apiToken2

Example for Records.http (Modified)

### kintone REST API Requests - App Records
@domain = your_subdomain.kintone.com
@appId = your_sales_deals_app_id
@apiToken1 = your_sales_deals_app_api_token
@apiToken2 = your_company_list_app_api_token
@userCode = Administrator

### GET/records
GET https://{{domain}}/k/v1/records.json?app={{appId}}
X-Cybozu-API-Token: {{apiToken1}}

### POST/records
POST https://{{domain}}/k/v1/records.json
X-Cybozu-API-Token: {{apiToken1}}, {{apiToken2}}
Content-Type: application/json

{
  "app": {{appId}},
  "records": [
    {
      "Company_Name_Search": {
        "value": "Kintone"
      },
      "Deal_Name": {
        "value": "Kintone app creation"
      },
      "Rep": {
        "value": [{"code": "{{userCode}}"}]
      }
    },
    {
      "Company_Name_Search": {
        "value": "Cybozu"
      },
      "Deal_Name": {
        "value": "Kintone JavaScript customization"
      },
      "Rep": {
        "value": [{"code": "{{userCode}}"}]
      }
    }
  ]
}

Reference: