[JAVA] I'm addicted to Kintone as a data store

Kintone Beginner Advent Calendar Day 4

sorry. I just forgot that it was yesterday.

Oh, I've done it ~. I feel like. I have written the fourth day today. I'm sorry. I would like to keep up with the traps that I tend to get hooked on. </ strong>

Why is this theme?

Actually, I was addicted to this problem at the Heroes League Ogaki Python Hackathon. It implements the wrong API token and URL location. This is the best trap. You must first realize that Kintone is really close to the framework for creating apps. Actually, I implemented it in Python this time, but the easiest one is Node.js. Because I was tied up with Python, my previous job in C # was actually Python, so I was able to work with Susui because I was learning. But what I made a mistake here is the location of the API key. @RyBB also points out. If you hurry, you will make a mistake.

kintone_output.py


#So far, everything is going well.
#The problem is from here.
#Where do you look?
#The URL behind the API token Curl.
URL = 
#API tokens are often mistaken.
#Caution is required.
#I am also Node.I made a mistake when I was taught by js.
#Copy the part of the API token.
API_TOKEN = 

#From here onward, there is no problem with normal code.
#If you make a mistake in the above two, it will hurt.
def get_kintone(url, api_token):
    "Function to get all kintone records"
    headers = {"X-Cybozu-API-Token": api_token}
    resp = requests.get(url, headers=headers)
    return resp

if __name__ == "__main__":
    RESP = get_kintone(URL, API_TOKEN)

    print(RESP.text)

nodejs:kintone.js


const kintone = require('@kintone/kintone-js-sdk');
//It's here.
//Please be careful.
//I was also addicted to it.
const domainName = 'SUB_DOMAIN.cybozu.com'; // Your kintone URL
//It's here.
//Please be careful.
const APIToken = 'YOUR_API_TOKEN'; // Your API Token
const appId = ○○; // AppID
const record = {
  text: {
    value: 'Text you want to add'
  }
};

// Connection
const kintoneAuth = new kintone.Auth();
kintoneAuth.setApiToken({apiToken: APIToken});
const kintoneConnection = new kintone.Connection({domain: domainName, auth: kintoneAuth});

const kintoneRecord = new kintone.Record({connection: kintoneConnection});

// Add Record
kintoneRecord.addRecord({app: appId, record: record}).then((rsp) => {
  console.log(rsp);
}).catch((err) => {
  console.log(err.get());
});

If you pay attention to these two points, Kintone will be an invincible weapon in the hackathon. It's easier than messing around with the database. Everyone tends to run in the cloud, but in my case the hackathon is definitely Kintone. It is also invincible for hackathon map mashups.

Hmm. I will use Kinetone at the hackathon next year as well. @RyBB.

Recommended Posts

I'm addicted to Kintone as a data store
[Python] How to store a csv file as one-dimensional array data
I'm addicted to Python 2D lists
I made a tool to easily display data as a graph by GUI operation.
I'm addicted to the difference in how Flask and Django receive JSON data
How to disguise a ZIP file as a PNG file
Python C / C ++ Extension Pattern-Pass data to Python as np.array
Randomly sample MNIST data to create a dataset
Use a cool graph to analyze PES data!
To myself as a Django beginner (3)-Hello world! ---
I want to give a group_id to a pandas data frame
How to display DataFrame as a table in Markdown
Write data to KINTONE using the Python requests module
[Spark] I'm addicted to trapping "", null and [] in DataFrame
A story that I was addicted to at np.where
A story about struggling to loop 3 million ID data
I'm a windows user but want to run tensorflow
To myself as a Django beginner (1) --Create a project app--
To myself as a Django beginner (4) --Create a memo app--
To myself as a Django beginner (2) --What is MTV?
The story I was addicted to when I specified nil as a function argument in Go