I am trying to get some data from land registry API (http://landregistry.data.gov.uk/app/hpi/qonsole) and it uses SPARQL query. I am new to sparql queries and not sure what to pass in my param.query object and how to pass prefixes required.
//myCode
var req = {
method: 'GET',
url: 'http://landregistry.data.gov.uk/landregistry/query',
headers: { 'Content-type' : 'application/x-www-form-urlencoded',
'Accept' : 'application/sparql-results+json' },
params: {
query :"select ?paon ?saon ?street ?town ?county ?postcode ?amount ?date where {?addr lrcommon:postcode "PL6 8RU"} limit 10",
format: "json"
}
};
console.log(req)
// SparQL Query
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix sr: <http://data.ordnancesurvey.co.uk/ontology/spatialrelations/>
prefix lrhpi: <http://landregistry.data.gov.uk/def/hpi/>
prefix lrppi: <http://landregistry.data.gov.uk/def/ppi/>
prefix skos: <http://www.w3.org/2004/02/skos/core#>
prefix lrcommon: <http://landregistry.data.gov.uk/def/common/>
#-- Returns the Price Paid data from the default graph for each transaction record having
#-- an address with the given postcode.
#-- The postcode to query is set in the line - ?address_instance common:postcode "PL6 8RU"^^xsd:string .
SELECT ?paon ?saon ?street ?town ?county ?postcode ?amount ?date
WHERE
{
?transx lrppi:pricePaid ?amount ;
lrppi:transactionDate ?date ;
lrppi:propertyAddress ?addr.
?addr lrcommon:postcode "PL6 8RU"^^xsd:string.
?addr lrcommon:postcode ?postcode.
OPTIONAL {?addr lrcommon:county ?county}
OPTIONAL {?addr lrcommon:paon ?paon}
OPTIONAL {?addr lrcommon:saon ?saon}
OPTIONAL {?addr lrcommon:street ?street}
OPTIONAL {?addr lrcommon:town ?town}
}
ORDER BY ?amount
You are half way there. You would use Angular's $http service with the request object you developed (assuming you populate the query string properly). $http service returns a promise, which you can resolve using the shortcut methods available (.success and .error). For these you specify a callback function that is called asynchronously when a response is ready. For example:
$http({
url: 'http://landregistry.data.gov.uk/landregistry/query',
headers: { 'Content-type' : 'application/x-www-form-urlencoded',
'Accept' : 'application/sparql-results+json' },
method: "GET",
params: {
query : "select * where {?s a ?o} limit 10",
format: "json"
}
})
.success(function(data, status, headers, config) {
// callback called asynchronously when the response is available
$scope.results = data.results.bindings;
})
.error(function(data, status, headers, config) {
// called asynchronously if an error occurs
// or server returns response with an error status
});
Here's a working plunker that executes the above query and displays the result.
I think, you can use this answer: How do I POST urlencoded form data with $http in AngularJS? to form your request, and you supply query in the data:
data: {query: "Put your SPARQL Query here"}
SPARQL query is everything below "// SparQL Query" in your listing, just a multiline text in a JavaScript string. (Creating multiline strings in JavaScript for multiline string in JavaScript). For example, if I put it into text file yourquery.txt, I can fetch results with curl:
curl --data-urlencode "query#yourquery.txt" http://landregistry.data.gov.uk/landregistry/query
and it returns nice json:
{
"head": {
"vars": [ "paon" , "saon" , "street" , "town" , "county" , "postcode" , "amount" , "date" ]
} ,
"results": {
"bindings": [
{
"paon": { "datatype": "http://www.w3.org/2001/XMLSchema#string" , "type": "typed-literal" , "value": "58" } ,
"street": { "datatype": "http://www.w3.org/2001/XMLSchema#string" , "type": "typed-literal" , "value": "PATTINSON DRIVE" } ,
"town": { "datatype": "http://www.w3.org/2001/XMLSchema#string" , "type": "typed-literal" , "value": "PLYMOUTH" } ,
"county": { "datatype": "http://www.w3.org/2001/XMLSchema#string" , "type": "typed-literal" , "value": "CITY OF PLYMOUTH" } ,
"postcode": { "datatype": "http://www.w3.org/2001/XMLSchema#string" , "type": "typed-literal" , "value": "PL6 8RU" } ,
"amount": { "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "type": "typed-literal" , "value": "56000" } ,
"date": { "datatype": "http://www.w3.org/2001/XMLSchema#date" , "type": "typed-literal" , "value": "1999-11-08" }
} ,
...
}
NB. I am using POST, not GET - this is not essential.
Remark:
?addr lrcommon:postcode "PL6 8RU"^^xsd:string.
?addr lrcommon:postcode ?postcode.
This is not quite good. It's better to use VALUES or BIND:
BIND ("PL6 8RU"^^xsd:string AS ?postcode)
?addr lrcommon:postcode ?postcode.
Because this is what is presumably wanted here. See SPARQL Query language specs for details.
If JavaScript variable's needs to be used in the query, then the value should be escaped and concatenation used:
'BIND ("' + escapedPostcodeVar + '"^^xsd:string AS ?postcode)'
See documentation for details on what and how to escape.
For the reference, working SPARQL query:
var myquery = 'prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n\
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n\
prefix owl: <http://www.w3.org/2002/07/owl#> \n\
prefix xsd: <http://www.w3.org/2001/XMLSchema#> \n\
prefix sr: <http://data.ordnancesurvey.co.uk/ontology/spatialrelations/> \n\
prefix lrhpi: <http://landregistry.data.gov.uk/def/hpi/> \n\
prefix lrppi: <http://landregistry.data.gov.uk/def/ppi/> \n\
prefix skos: <http://www.w3.org/2004/02/skos/core#> \n\
prefix lrcommon: <http://landregistry.data.gov.uk/def/common/> \n\
\n\
SELECT ?paon ?saon ?street ?town ?county ?postcode ?amount ?date \n\
WHERE \n\
{ \n\
BIND ("PL6 8RU"^^xsd:string AS ?postcode) \n\
\n\
?addr lrcommon:postcode ?postcode. \n\
\n\
?transx lrppi:pricePaid ?amount ; \n\
lrppi:transactionDate ?date ; \n\
lrppi:propertyAddress ?addr. \n\
\n\
OPTIONAL {?addr lrcommon:county ?county} \n\
OPTIONAL {?addr lrcommon:paon ?paon} \n\
OPTIONAL {?addr lrcommon:saon ?saon} \n\
OPTIONAL {?addr lrcommon:street ?street} \n\
OPTIONAL {?addr lrcommon:town ?town} \n\
} \n\
ORDER BY ?amount \n\
LIMIT 10'
Then in $http:
params: {query: myquery}
Related
I tried to change the users password through graph api to word containing german umlauts (e.g. ä, ö, ü, etc). But these passwords are rejected with error message :
"Invalid format: Invalid characters in password"
Through graph explorer I call
PATCH https://graph.microsoft.com/v1.0/me/
{
"passwordProfile": {
"forceChangePasswordNextSignIn": false,
"password": "Valid2018"
}
}
And it returns a Success - Status Code 200. But if I change the password to:
PATCH https://graph.microsoft.com/v1.0/me/
{
"passwordProfile": {
"forceChangePasswordNextSignIn": false,
"password": "Gültig2018"
}
}
I will get:
{
"error": {
"code": "Request_BadRequest",
"message": "Invalid format: Invalid characters in password",
"innerError": {
"request-id": "...",
"date": "..."
},
"details": [
{
"target": "password",
"code": "GenericError"
}
]
}
}
So why are german umlauts forbidden in Graph API??
Unfortunately,as juunas said that AAD doesn't allow non-Latin characters. For now, AAD Password policies that only allows following Characters:
A – Z
a - z
0 – 9
# # $ % ^ & * - _ ! + = [ ] { } | \ : ‘ , . ? / ` ~ “ ( ) ;
See more details about AAD Password policy in this document.
Using outlook I am trying to create event, When i send request using POSTMAN its working fine, But same code in Angularjs its not wotking.
what is wrong with code.
Please help.
$scope.createEvents = function(){
var url = "https://outlook.office.com/api/v2.0/$metadata#Me/Calendars";
//var url = "https://outlook.office.com/api/v2.0/$metadata#me/Calendars";
var add_events = {
"Subject": "Discuss the Calendar REST API",
"Body": {
"ContentType": "HTML",
"Content": "I think it will meet our requirements!"
},
"Start": {
"DateTime": "2016-10-10T18:00:00",
"TimeZone": "Pacific Standard Time"
},
"End": {
"DateTime": "2016-10-10T19:00:00",
"TimeZone": "Pacific Standard Time"
},
"Attendees": [
{
"EmailAddress": {
"Address": "sathish.gopikrishnan#stradegi.com",
"Name": "Sathish Gopi"
},
"Type": "Required"
}
]
};
$http({
method: 'POST',
url: url,
headers:{
'Authorization':'Bearer '+$scope.token,
'Content-Type': "application/json",
'Accept': 'application/json;odata.metadata=minimal',
'Access-Control-Allow-Origin':'*'
},
data: add_events
}).Succes(function (response) {
alert("Saved")
});
I am getting.
Failed to load resource: the server responded with a status of 406 (Not Acceptable). To solve this problem i am using this code now
$scope.createEvents = function(){
var url = "https://outlook.office.com/api/v2.0/$metadata#Me/Calendars";
//var url = "https://outlook.office.com/api/v2.0/$metadata#me/Calendars";
var add_events = {
"Subject": "Discuss the Calendar REST API",
"Body": {
"ContentType": "HTML",
"Content": "I think it will meet our requirements!"
},
"Start": {
"DateTime": "2016-10-10T18:00:00",
"TimeZone": "Pacific Standard Time"
},
"End": {
"DateTime": "2016-10-10T19:00:00",
"TimeZone": "Pacific Standard Time"
},
"Attendees": [
{
"EmailAddress": {
"Address": "sathish.gopikrishnan#stradegi.com",
"Name": "Sathish Gopi"
},
"Type": "Required"
}
]
};
$http({
method: 'JSONP',
url: url,
headers:{
'Authorization':'Bearer '+$scope.token,
'Content-Type': "application/json",
'Accept': 'application/json;odata.metadata=minimal',
'Access-Control-Allow-Origin':'*'
},
data: add_events
}).Succes(function (response) {
alert("Saved")
});
After Using Jsonp as method I am getting this error
Uncaught SyntaxError: Unexpected token <
406 Not Acceptable is defined as the following:
The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request.
see restapitutorial: http status codes
You send the following Accept header:
'Accept': 'application/json;odata.metadata=minimal'
The server says, it cannot produce this content type. If you got it running using postman, have a look at which accept header you've provided there.
Concerning your second try: jsonp is not an http method/verb (GET, PUT, POST, DELETE, PATCH). I'm not an angularjs expert but in case you need jsonp, there is a method you can call.
JSONP is a quite specific (and somewhat problematic) technique. So as long as you can do that, try to avoid it.
i know its an old post, i've had the same problem and this is the solution if someone falls into the same problem,
you should use https://graph.microsoft.com/v1.0/me/calendar/events as URL
Exemple tested code :
var url = "https://graph.microsoft.com/v1.0/me/calendar/events";
var add_events = {
"Subject": "Title",
"Body": {
"ContentType": "HTML",
"Content": " Exemple"
},
"Start": {
"DateTime": "2010-05-17T18:00:00",
"TimeZone": "UTC"
},
"End": {
"DateTime": "2010-05-17T19:00:00",
"TimeZone": "UTC"
}
};
$http({
method: 'POST',
url: url,
headers:{
'Authorization':'Bearer '+localStorage.getItem('Your Token here'),
'Content-Type':'application/json',
'Accept': 'application/json;odata.metadata=minimal',
'Access-Control-Allow-Origin':'*',
'token_type':'Bearer'
},
data: add_events
}).then(function successCallback(response) {
console.log(response);
}, function errorCallback(response) {
localStorage.setItem('etat_mytoken', 0);
$window.location.href = url_base+'/'+url_base_v+'/app/assets/views/token.html';
});
So I have newly upgraded to Swagger 2 from 1.x, and am experiencing an odd issue. One of my APIs is getting an incorrect content-type injected into the header and I have no idea where from, you can see below in the SwaggerJSON, The DELETE function even says it consumes application/json, but the CURL(copied from inspect panel) for it sends 'Content-Type: text/plain;charset=UTF-8'. I have provided the CREATE function as a cursory example to show that otherwise the similar apis work fine. I think this is an issue with swagger-js-codegen because if I put the same request into the api-docs it works fine, or of course my Java, or somewhere somehow my content-type header is getting set, but i have no idea how or where. Am I missing something? The API acts the same whether or not my JAVA claims 'consume = "application/json"' or not.
Swagger JSON
{
"/api/entities/{id}/labels": {
"delete": {
"consumes": [
"application/json"
],
"operationId": "deleteEntityLabel",
"parameters": [
{
"default": "16_appiniteDev",
"description": "The id of the entity to be edited",
"in": "path",
"name": "id",
"required": true,
"type": "string"
},
{
"description": "The label/labels to be deleted",
"in": "body",
"name": "labels",
"required": true,
"schema": {
"items": {
"type": "string"
},
"type": "array"
}
}
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ResponseEntity"
}
},
"204": {
"description": "No Content"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"summary": "Deletes Labels for Entities",
"tags": [
"entity-resource"
]
},
"post": {
"consumes": [
"application/json"
],
"operationId": "createEntityLabel",
"parameters": [
{
"default": "16_appiniteDev",
"description": "The id of the entity to be edited",
"in": "path",
"name": "id",
"required": true,
"type": "string"
},
{
"description": "The array of labels to be set",
"in": "body",
"name": "labels",
"required": true,
"schema": {
"items": {
"type": "string"
},
"type": "array"
}
}
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ResponseEntity"
}
},
"201": {
"description": "Created"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"summary": "Creates Labels for Entities",
"tags": [
"entity-resource"
]
}
}
}
DELETE
JAVA/SPRING
/**
* DELETE /entities/{id}/labels -> delete labels for an entity
*
* #param id
* #param labels
* #throws ServiceException
*/
#RequestMapping(value = "/entities/{id}/labels", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
#Timed
#ApiOperation(value = "Deletes Labels for Entities", nickname = "deleteEntityLabel", consumes = "application/json")
public ResponseEntity deleteLabels(
#ApiParam(value = "The id of the entity to be edited", required = true, defaultValue = "16_appiniteDev") #PathVariable final String id,
#ApiParam(value = "The label/labels to be deleted", required = true, defaultValue = "[\"label1\",\"label2\",\"label3\"]") #NotNull final #RequestBody String[] labels
) throws ServiceException {
boolean isAppEntity = false;
User user = userService.getUserWithAuthorities();
String[] type = id.split("_");
if (StringUtils.isNumeric(type[0]) && !type[1].startsWith(type[0])) {
isAppEntity = true;
}
entityService.deleteTags(id, labels, user, isAppEntity);
Map<String, String> response = new LinkedHashMap<>();
response.put(Constants.RESPONSE_ENTITY_HEADER_MESSAGE,
"Labels deleted successfully");
return new ResponseEntity(response, HttpStatus.OK);
}
CURL FROM APP
curl 'http://localhost:8080//api/entities/52_QA42/labels?cacheBuster=1472070679337' -X DELETE -H 'Pragma: no-cache' -H 'Origin: http://localhost:8080' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36' -H 'Content-Type: text/plain;charset=UTF-8' -H 'Accept: application/json, text/plain, */*' -H 'Cache-Control: no-cache' -H 'x-auth-token: admin:1472097365429:8e6524e252e2aebb786b7738c44fe385' -H 'Referer: http://localhost:8080/' -H 'Cookie: NG_TRANSLATE_LANG_KEY=%22en%22' -H 'Connection: keep-alive' -H 'DNT: 1' --data-binary '["Bug13124"]' --compressed
CREATE
JAVA/SPRING
/**
* POST /entities/{id}/labels -> add labels for a non hadoop entity
*
* #param id
* #param labels
* #throws ServiceException
*/
#RequestMapping(value = "/entities/{id}/labels", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
#Timed
#ApiOperation(value = "Creates Labels for Entities", nickname = "createEntityLabel")
public ResponseEntity addLabels(
#ApiParam(value = "The id of the entity to be edited", required = true, defaultValue = "16_appiniteDev") #PathVariable final String id,
#ApiParam(value = "The array of labels to be set", required = true, defaultValue = "[\"label1\",\"label2\",\"label3\"]") #NotNull final #RequestBody String[] labels)
throws ServiceException {
boolean isAppEntity = false;
User user = userService.getUserWithAuthorities();
String[] type = id.split("_");
if (StringUtils.isNumeric(type[0]) && !type[1].startsWith(type[0])) {
isAppEntity = true;
}
entityService.addTags(id, labels, user, isAppEntity);
Map<String, String> response = new LinkedHashMap<>();
response.put(Constants.RESPONSE_ENTITY_HEADER_MESSAGE,
"Labels added successfully");
return new ResponseEntity(response, HttpStatus.OK);
}
CURL FROM APP
curl 'http://localhost:8080//api/entities/52_QA42/labels?cacheBuster=1472071851544' -H 'Pragma: no-cache' -H 'Origin: http://localhost:8080' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36' -H 'Content-Type: application/json;charset=UTF-8' -H 'Accept: application/json, text/plain, */*' -H 'Cache-Control: no-cache' -H 'x-auth-token: admin:1472097365429:8e6524e252e2aebb786b7738c44fe385' -H 'Referer: http://localhost:8080/' -H 'Cookie: NG_TRANSLATE_LANG_KEY=%22en%22' -H 'Connection: keep-alive' -H 'DNT: 1' --data-binary '["test"]' --compressed
Any Ideas?
I haven't been able to nail down how or where it is setting that Content-Type, so I've fixed this in a brute force way: Created an interceptor to change the header content-type by force:
.factory('contentInterceptor', function ($rootScope, $q, $location, localStorageService, $cookies) {
return {
// Add authorization token to headers
request: function (config) {
config.headers = config.headers || {};
config.headers['Content-Type'] = 'application/json';
return config;
}
};
})
.config(function ($httpProvider) {
$httpProvider.interceptors.push('contentInterceptor');
});
Works like a charm, and luckily doesn't affect any other of my API's as they ALL require Application/JSON except for the multipart form ones, but those explicitly get set and aren't affected by this interceptor.
**** UPDATE *****
I'm a dumb dumb and didn't realize I could've just put the following in my mustache template. This is the correct answer. It takes the proper 'consumes' and 'produces' properties and ensures the right headers are being sent.
{{#headers}}
options.headers['{{&name}}'] = {{&value}};
{{/headers}}
I've got an app based on djangoappengine, Backbone.js and Django REST Framework that uses PATCH requests to update models via {patch: true} on a model.save call.
I've found that when testing locally the dev_appserver returns:
ERROR 2014-02-19 04:37:04,531 dev_appserver.py:3081] code 501, message Unsupported method ('PATCH')
INFO 2014-02-19 04:37:04,532 dev_appserver.py:3090] "PATCH /api/posts/5707702298738688 HTTP/1.1" 501 -
Yet when I deploy it and access it through appspot the server happily accepts the request. Which forces me to deploy every time I make a change and want to test it.
I'm running the latests version (1.89) of the Python SDK, and found and old fixed issue that seems to tackle it but it seems other people have had it.
I tried this patch but it didn't make a difference. I don't understand why the development server would reject them and not the production server, is there something I need to change?
Thanks.
To update a resource, you can use POST with the x-http-method-override to patch. This is a valid RESTful operation and using POST will be more compatible with firewall and older user agents. The data in the request should indicate what is to be updated.
var url = '/api/posts/5707702298738688'
var patch_ops = [
{ "op": "replace", "path": "/properties/", "author": text}
{ "op": "add", "path": "/replies/", {"author": text, "comment":"blah"}}
/*
{ "op": "remove", "path": "/a/b/c" },
{ "op": "add", "path": "/a/b/c", "value": [ "foo", "bar" ] },
{ "op": "replace", "path": "/a/b/c", "value": 42 },
{ "op": "move", "from": "/a/b/c", "path": "/a/b/d" },
{ "op": "copy", "from": "/a/b/d", "path": "/a/b/e" }
*/
];
var xhr = jQuery.ajax({
type: "POST",
beforeSend: function (request)
{
request.setRequestHeader("X-HTTP-Method-Override", "PATCH");
},
url: url,
data: my_json_string,
dataType:"json",
success: function(data) {
return data;
},
error: function(xhr, textStatus, error){
return error;
}
});
Server handler:
def post(self, object_name):
if self.request.headers['x-http-method-override'] == 'PATCH':
# update according to patch operations
patch_ops_str= self.request.body.decode('utf-8')
try:
patch_ops = json.loads(new_area_geojson_str)
except:
self.response.set_status(400)
return self.response.out.write('{"status": "error", "reason": "JSON Parse error" }')
else:
self.response.set_status(405)
return self.response.out.write('{"status": "error", "reason": "post not accepted without x-http-method-override to PATCH" }')
Adapted from Please do not patch like an idiot
How to load data in grid from server I am able to load data from Store to grid but not able to load data from server to the store and then into grid Server API Details :
http://192.1681.102:8080/Petcrumbs/member/getMemberList
Request Parameters :
{"pageNumber":5}
Response Success :
{
"listOfMembers":
[
{
"address":
{
"state": "MH",
"country": "India",
"city": "Pune",
"addressId": 52,
"streetName": "Karve Road",
"streetNameTwo": "Nal Stop",
"zipCode": "412042"
},
"name": "Test Mmber4",
"password": "287974",
"authKey": "99710ff8d98346f51a7b3df83c16257",
"gender": "Male",
"deviceToken": "ldjhakjhdkjahn42,n4lk2jedlkandmandlkand",
"community": "Kothrud",
"emailId": "r.pekam#mb.com",
"phone": "9096305571",
"image": null,
"memberId": 41,
"active": 1,
"deleted": false,
"myPackage": "Gold",
"joinedDate": "09-17-2013"
}
],
"message": "Member retrieved successfully.",
"success": true
}
Response Failure :
{
"listOfMembers": null,
"message": "Unable to retrieve members.",
"success": false
}
In EXTJS Store
Ext.define('PetCrumbs.store.Members', {
extend : 'Ext.data.ArrayStore',
model : 'PetCrumbs.model.Member',
autoLoad : true,
//storeId : 'Data',
proxy : {
type : 'ajax',
url : '/Petcrumbs/member/getMemberList',
method : 'POST',
headers : {
'Content-Type' : 'application/json',
'Accept' : 'application/json'
},
jsonData : {
pageNumber : "5"
},
reader : {
type : 'json',
root: 'listOfMembers',
successProperty: 'success'
}
}
});
When I have Store like this ( Hard Coded Data ) grid displays data :
Ext.define('PetCrumbs.store.Members', {
extend: 'Ext.data.ArrayStore',
model: 'PetCrumbs.model.Member',
data: [
['1','1002','Asin','kothroud#gmail.com','kothrud,Pune','MH',
'Pune','411051','Male','Gold','Kothrud','1'],['2','1012','Karina','Pashan#gmail.com',
'Pashan,Pune','MH','Pune','411051','Female','Silver','Pashan','0']
]
});
Please tell me what is wrong with the above code ?
Can you modify the way your server sends the data? the easiest would be to use a plain Ext.data.Store with Ext.data.reader.Json. To use this your JSON should look like:
{
"listOfMembers": [
{"attr1":"value1",:"attr2":"value2",...},...
],
"message": "Unable to retrieve members.", "success": false
}
Then it will be straight forward.
If you want to continue with your output you have to either modify the reader or define more complex object relations.
My guess would be that you use ArrayStore, which works well with locally hardcoded data (as it is array), but when you want to load data remotely - you should extend Ext.data.Store instead?
You are using ArrayStore, but server returns JSON. So you should use JsonStore. Or just basic store with configured reader