Hi,
When I try to execute the following code, I receive a 502 error. I got the same result with a curl command generated by the backendless rest console.
The input object contains data.
var url = ‘http://api.backendless.com/v1/data/Ecole/’ + input.objectid;
var data = {
“website”: input.website,
“address”: input.address,
“city”: input.city,
“commission_name”: input.commissionname,
“phone”: input.phone,
“name”: input.name,
“postal_code”: input.postalcode,
“email”: input.email,
“reseau”: input.reseau
};
fetch(url,{
method: ‘PUT’,
headers: {
‘application-id’: ‘xxxxxx’,
‘secret-key’: ‘xxxxxx’,
‘Content-Type’: ‘application/json’,
‘application-type’: ‘REST’
},
body: JSON.stringify(data)
})
.then(function(res) {
return res;
})
.then(function(json) {
callback(null, json);
}).catch(callback);
I tried the same rest call by using the curl command and I got the same result.
curl -H application-id:xxxxxxxxxx -H secret-key:xxxxxxxx -H Content-Type:application/json -X PUT -d “{"name":"CHABOTe", "reseau": "Publique" }” -v https://api.backendless.com/v1/data/Ecole/016s4QDBbr
-
Trying 149.56.79.124…
-
Connected to api.backendless.com (149.56.79.124) port 443 (#0)
-
TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
-
Server certificate: *.backendless.com
-
Server certificate: COMODO RSA Domain Validation Secure Server CA
-
Server certificate: COMODO RSA Certification Authority
-
Server certificate: AddTrust External CA Root
PUT /v1/data/Ecole/016s4QDBbr HTTP/1.1
Host: api.backendless.com
User-Agent: curl/7.43.0
Accept: /
application-id:xxxxxxxxx
secret-key:xxxxxxxx
Content-Type:application/json
Content-Length: 41
- upload completely sent off: 41 out of 41 bytes
< HTTP/1.1 502 Bad Gateway
< Server: nginx/1.8.1
< Date: Thu, 28 Jul 2016 02:59:00 GMT
< Content-Type: text/html
< Content-Length: 172
< Connection: keep-alive
<
<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.8.1</center>
</body>
</html>
Hi Olivier
Could you check please is this problem still exist
Thanks
Hi Vitaly,
Yeah, the problem is still there. If I change the request and I keep only one attribute to update (like “reseau”), I get a HTTP 200. If I change the request and I keep only 2 attributes (or more) to update (like “reseau” and “name”) its not working anymore, I get a HTTP 502. But if I change the request and update only the attribute “name”, its not working (HTTP 502).
I dont know, but I think there are attributes that I cant update. I never edited the security settings in my backendless console.
Ok
I have created an internal ticket BKNDLSS-13088 to investigate this problem
We will notify you about the results
Hi Olivier,
Can you please provide your application ID? I need it in order to reproduce the issue with the CURL request you provided:
curl -H application-id:xxxxxxxxxx -H secret-key:xxxxxxxx -H Content-Type:application/json -X PUT -d "{\"name\":\"CHABOTe\", \"reseau\": \"Publique\" }" -v [url=https://api.backendless.com/v1/data/Ecole/016s4QDBbr]https://api.backendless.com/v1/data/Ecole/016s4QDBbr[/url]