# REST API GetUser Problem

**URL:** <https://forum.kintone.dev/t/rest-api-getuser-problem/710>\
**Category:** General\
**Tags:** rest-api\
**Created:** [January 24, 2023, 3:25am UTC](https://forum.kintone.dev/t/rest-api-getuser-problem/710 "2023-01-24T03:25:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jayron\_Rosel](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/jayron_rosel/32/179_2.png) [@Jayron\_Rosel](https://forum.kintone.dev/u/Jayron_Rosel)\
**Post date:** [January 24, 2023, 3:25am UTC](https://forum.kintone.dev/t/rest-api-getuser-problem/710/1 "2023-01-24T03:25:44Z")

</div>

## 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

```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:

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/kintone/original/1X/9353892642833e9fddc6c15ee06d27f1fda7288f.png)

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

 ![Screenshot of the console log](https://canada1.discourse-cdn.com/flex035/uploads/kintone/original/1X/3f41a7bc16d4eaef462d67f283801329415fc9e3.png)

## Referenced Resources

I am following the [Kintone Technical Training - REST API - YouTube](https://www.youtube.com/watch?v=VpWyDbhhEcg) tutorial but stuck on this step.

---

<div class="post-metadata">

**Author:** ![Genji](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/genji/32/646_2.png) [@Genji](https://forum.kintone.dev/u/Genji)\
**Post date:** [January 24, 2023, 7:02am UTC](https://forum.kintone.dev/t/rest-api-getuser-problem/710/2 "2023-01-24T07:02:21Z")

</div>

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)

```http
### 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:

- [kintone-technical-training-materials/Example for Records.http at master · Cybozu-GTA/kintone-technical-training-materials · GitHub](https://github.com/Cybozu-GTA/kintone-technical-training-materials/blob/master/REST%20API/Request%20Example/Example%20for%20Records.http)
- Kintone Technical Training - REST API - 23:24 [https://youtu.be/VpWyDbhhEcg?t=1404](https://youtu.be/VpWyDbhhEcg?t=1404)
