Im trying to send an http.post request from my angular app to the rest server using the following code:
I'm using: import { Http } from '@angular/http';
let headers = new Headers();
headers.append('Content-Type', 'application/json');
let data: string = 'wing,wheel';
this.http.post('http://172.16.2.209:3000/api/AddPartList?access_token=xxxxxxxxxxxx',{headers: headers},data)
But I keep getting the error Response with status: 422 Unprocessable Entity for URL
The curl command for what I want to do is:
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \
"$class": "org.blockaviation.AddPartList", \
"partListId": "1", \
"partList": "wing,wheel", \
"plane": "resource:org.blockaviation.Plane#Plane_001" \
\
}' 'http://172.16.2.209:3000/api/AddPartList'
Does anyone know what I'm doing wrong or how to do this properly?