0

print(element) print following

error = "Invalid request format."

Although the response.result is success.

I don't know what to do... appreciate any help.

let request = AF.request("https://api.pinata.cloud/pinning/pinFileToIPFS",
          method: .post,
          parameters: data,
          encoding: JSONEncoding.default,
          headers: [
            "Content-Type": "multipart/form-data;boundary=nadeshiko_data_boundary",
            "pinata_api_key": "myAPIKey",
            "pinata_secret_api_key": "mySecretApiKey"
        ])
        request.responseString { response in
            print("responseString responseee", response)
            switch response.result {
            case .success(let element):
                print(element)
            case .failure(let error):
                print("failure", error)
            }
        }
user16525780
  • 319
  • 1
  • 4
  • 11
  • - success : "{\"error\":{\"reason\":\"INVALID_API_KEYS\",\"details\":\"Invalid API key provided\"}}" You have to enter valid API key for get the proper response from API. Insert valid key of pinata_api_key and pinata_secret_api_key first. – Vishal_VE Jul 26 '21 at 06:51
  • Thank you for answering! but I do enter valid api key and private key in my actually code. – user16525780 Jul 27 '21 at 05:43
  • can you show me the response so I can identify the issue? of response.result – Vishal_VE Jul 27 '21 at 11:47

1 Answers1

0

I asked to pinata support.

Turns out I was trying to upload JSON file where I have to upload a File.

user16525780
  • 319
  • 1
  • 4
  • 11