[SOLVED] BSC explorer Json data

Yeah, sorry - I wasn’t able to upload more than one picture at a time. Here’s what the full request looks like in Swift:

func getHeldNFTs(walletAddress:String) {
        // Prepare URL
        let url = URL(string: "\(moralis.baseEndpoint)\(walletAddress)/nft?chain=\(chain)&format=decimal")
        var request = URLRequest(url: url!)
        // Set Request Headers
        request.setValue(moralis.apiKey, forHTTPHeaderField: "X-API-Key")
        // Perform Request
        URLSession.shared.dataTask(with: request) {(data, response, error) in

            if let responseData = try? JSONDecoder().decode(GetAllNFTResponse.self, from: data!) {
                let total = responseData.total

The original curl request (which works fine anywhere else) is:

curl -v \
	-X GET \
	-H "User-Agent: HTTPBot-iOS/2021.1" \
	-H "X-API-Key: MY-API-KEY" \

I’m wondering if it’s an issue with how Swift or Xcode requests the data. The POST requests work great; I can get data and pass it to an app without an issue. This simple one, though…

can you print somehow the url that you get here to check if it is the expected one?

hi there,
Where can I get MY-API-KEY?
Looking forward to any idea from anyone.

you get the api key from here: https://admin.moralis.io/web3Api

1 Like