1
votes

my azure sqldatabase old table are work proper when i insert or get data , but my requirement is new table create and insert data , i create new table using azure studio , table create successfully but i can't insert data on that table when i insert data i got error Like this :

▿ Optional

  • some : Error Domain=com.Microsoft.MicrosoftAzureMobile.ErrorDomain Code=-1302 "Cannot POST /tables/QOWResult " UserInfo={com.Microsoft.MicrosoftAzureMobile.ErrorResponseKey=<NSHTTPURLResponse: 0x60000031eea0> { URL: https://myurl/tables/QOWResult } { Status Code: 404, Headers { "Content-Length" = ( 30 ); "Content-Type" = ( "text/html; charset=utf-8" ); Date = ( "Wed, 31 Mar 2021 12:32:54 GMT" ); Server = ( "Microsoft-IIS/10.0" ); "X-Content-Type-Options" = ( nosniff ); "X-Powered-By" = ( Express, "ASP.NET" ); } }, NSLocalizedDescription=Cannot POST /tables/QOWResult , com.Microsoft.MicrosoftAzureMobile.ErrorRequestKey=<NSMutableURLRequest: 0x6000001d30c0> { URL: https://myurl/tables/QOWResult }}

i try create new table with azure portal too but when i insert table data on it , get error above , also i share my code of insert data.

static func addOneWayResult( item: [String: Any],  handler: @escaping(QwizzOnewayResult?, Error?) -> Void) {
    let table = client?.table(withName: "QOWResult")
    table?.insert(item) { (insertedItem, error) in
        guard error == nil else {
            handler(nil, error)
            return
        }
        handler(QwizzOnewayResult(JSON(insertedItem!)),nil)
    }
}

This are my column name of that table :-

[Senderid] nvarchar NOT NULL, [Sendername] nvarchar NOT NULL, [SenderAvtar] nvarchar NOT NULL, [Reciever_id] nvarchar NOT NULL, [Recievername] nvarchar NOT NULL, [RecieverAvtar] nvarchar NOT NULL, [GameID] nvarchar NOT NULL, [Gamename] nvarchar NOT NULL, [WinnerName] nvarchar NOT NULL, [InTime] nvarchar NULL, [AttempCounter] nvarchar NOT NULL, [create_date] [datetime] NOT NULL

Here is the old and new table list from studio

1
I don't know anything about azure but the http response is 404, page not found, so maybe start there. Maybe a spelling or configuration error somewhere. - Joakim Danielson
@JoakimDanielson i checked double time with old configuration, actually application have already existing table , so for create new table we have just follow the structure , and i did this but , i got error when i m insert data on that table, Anyway thanks for reply. - Jay Bhalani
Well it's clear to me that the endpoint for the table can't be found - Joakim Danielson
@JoakimDanielson Yes that's right but why this happen ? coz old all table work proper insert data as well as get data , only problem with newly created tables , and also i tried create another table and same error get !! i really don't understand why this happen for new table. and i know that table can't be found , actually table is there with old tables. - Jay Bhalani
i update question with showing table list with new created table - Jay Bhalani

1 Answers

0
votes

This is the situation

  • Insert into old tables works
  • Insert into new table returns a 404
  • All tables in same database

Based on this it is probably a rights issue.

The connection to the database is done in a context of a user. If that user does not have access to the table, it will return a 404 not found error.

You need to grant user rights on the new table.