LoginSignup
0
0

More than 3 years have passed since last update.

Swagger UIから一覧データを取得する【備忘録】

Last updated at Posted at 2019-06-03

はじめに

こちらは備忘録になります。
Swagger UIから一覧を取得するための、簡単なスクリプトを作成しました。

スクリーンショット 2019-06-03 22.15.24.png

スクリプト

const section = document.querySelectorAll(".opblock-tag-section");
for(let i=0;i<section.length;i++){
  if(section[i].getElementsByTagName("h4")[0].textContent == "default"){
    continue;
  }
  const apiSummary = section[i].querySelectorAll(".opblock-summary");

  for(let j=0;j<apiSummary.length;j++){
    let text = "";
    text += section[i].getElementsByTagName("h4")[0].textContent;
    text += "," + apiSummary[j].querySelector(".opblock-summary-method").textContent;
    text += "," + apiSummary[j].querySelector(".opblock-summary-path").textContent;
    text += "," + apiSummary[j].querySelector(".opblock-summary-description").textContent;
    console.log(text);
  }
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0