【解決方法】API の使用方法と VB.NET での表示方法

プログラミングQA


私はここが初めてで、APIの使用方法を学ぼうとしています。 APIを持つCMSデータセットを見つけました。 以下のリンクを参照してください。

https://data.cms.gov/provider-data/dataset/avax-cv19

質問:
この API を使用して gridview に表示するにはどうすればよいですか?
シンプルにするためにMVCを使用したくありません。

私が試したこと:

VB
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            
            TitleL.Text = GetAccountInfoFromApi("test")

        End If

    End Sub





    Private Function GetAccountInfoFromApi(accountno As String) As String
        Dim accountInformationUrl As String = "​/provider-data​/api​/1​/metastore​/schemas​/dataset​/items​/avax-cv19"
        Dim webClient As Net.WebClient = New WebClient()
        'Return webClient.DownloadString(New Uri(accountInformationUrl))
        Dim retString As String

        Try
            retString = webClient.DownloadString(New Uri(accountInformationUrl))

        Catch ex As WebException
            If ex.Status = WebExceptionStatus.ProtocolError AndAlso ex.Response IsNot Nothing Then
                Dim resp = DirectCast(ex.Response, HttpWebResponse)
                If resp.StatusCode = HttpStatusCode.NotFound Then
                    ' HTTP 404
                    'other steps you want here
                End If
            End If
            'throw any other exception - this should not occur
            Throw
        End Try
        Return retString

    End Function

解決策 1

次のドキュメントを参照してください。 メディケアおよびメディケイド サービス データ センター[^].

コメント

タイトルとURLをコピーしました