how to deserialize json to alpacajs specific format - alpacajs

Like how we have Serialize API available for translating the data in the form to JSON data, do we have a deserialize api CALL to translate the data from json into alpaca specific JS ?
We have a requirement to translate the JSON data into a AlpacaJS specific JSON . is there a easy way to do this ?

Related

Need Of Postman test case

I understand in postman we use test cases like status codes and response time to ensure API does not break but what is the necessity to validate the response body.
var schema
var jsonData = JSON.parse(responseBody);
tests["Verify that the Schema is Valid"] = tv4.validate(jsonData, schema);
To answer your question, Why is JSON Schema Validation required?
We monitor API responses and ensure that the format that we are getting is the same as the expected one.
We get alerts whenever there is any breaking change in the JSON response.
We use JSON Schema to construct a model of API response and it makes easier to validate
that API is returning the valid data.

ember member actions normalizing response

I am using ember member API actions and was wondering how can response be normalized in such cases.
I have a model "users" with member action "postAddress". It is a post request which returns me a response. Now the problem I am facing is data is not normalized as returned data does not map to any store model. I know when we do a findAll and give a model, then ember automatically normalizes the data returned from API call. But in case of member actions, can anyone suggest how can data be normalized? (snake case to camel case).
ember-api-actions addon does not provide any serializer integration. There is an open issue about it. As discussed there you could manually push the response to store using pushPayload method of store service provided by Ember Data.
If you don't want to push the data into the store but just use a Serializer to normalize the response, you could do so by combining serializerFor() method of DS.Store and normalizeResponse() method of DS.Serializer.

Isomorphic fetch and Django view

I'm sending a POST request to Django view using isomorphic fetch.
body : "{"email":"admin#example.com","password":"11"}"
credentials : "same-origin"
headers :
Accept : "application/json"
Content-Type : "application/json"
X-CSRFToken : "mudIfipiyLUao2ZWwoEotFOUknYeVpZASNpQQ2IdadRVOe0a9n5tUqcKzwtrDuWX"
method : "POST"
When I send this request to DRF view, I can read the data using request.data. However when I send the same data to Django view, request.POST is empty.
What could be the reason?
It appears that isomorphic fetch is probably not playing a critical role in why request.POST is empty but rather that request.POST only seems to be populated by form data, not JSON data. This is supported by this quote from the Django REST Framework docs:
It (request.data) supports REST framework's flexible request parsing, rather than just supporting form data
Also, note the advice from Malcom Tredinnick:
If you're doing REST-based web service stuff ... you should ignore request.POST
This is in reference to the fact that DRF handles a lot of stuff behind the scenes for you such as serializing things and assigning to different variables and by inter-operating with the pure Django equivalents you may get weird results.

mysql Database lookup using wso2esb or wso2-am

Just as the title suggests.
I want to wrap a database call in an API or REST API whichever is easiest preferable API Manager API.
How can i do this and return the data from the database in json?
You can use DSS to access the database, and then a payload factory mediator or Data Mapper to transform the response in a json.
Alternatively, you can use DSS to expose your data as a set of REST style resource.Take a look at this link for an example on how to achieve this.

API Key implementation on a Django backend

I'm implementing a simple API using a Django back-end and want to support access control using API keys.
As is the standard, the protocol will use a combination of a private key and a public identifier to authenticate the request. The public identifier, data and hash(data+private key) will be sent to the server. The server will then duplicate the hashing function using the private key stored in the database and if the hashes match then the request is authenticated.
My question is regarding the 'data' portion. Of course, the client and the server need to agree on what 'data' is, otherwise the hashes won't match. The protocol can simply dictate that the 'data' is the raw query string as sent by the browser. In that case, how do I retrieve the raw query-string from the Django view (it parses it in a QueryDict thus losing the sequence information)?
Or are there any other best practices that I am missing?
You can always get the raw query data via request.body (or request.raw_post_data in versions before 1.4).