I installed a new Drupal 7.56 distribution. I want to create new nodes via java client. However, After little googling I found the “Services” module for Drupal 7.
So I installed it, with the next module:
- Services
- Ctools (required for Services)
- Libraries (required for Services)
- OAuth 1.0
So, I installed these modules. From the Structure menu I created the Service.
- Endpoint: API
- Server: REST
I enabled the Session and OAuth authentication.
I created a new Content type. name: TestContent (Machine name: testcontent) Fields:
- Title (M.n.:
title
) - Body (M.n.:
body
) - Pics (M.n:
field_pics
) (Type: Image) Number of values: 5
In this Service I enabled all resource (file, user, etc..) I Disabled the OAuth, because I will set up it later.
Now, I opened my Postman client. Logging in: admin/admin
{
"sessid": "QZTYSQu3-I9pacOpoSP--V_LkGcusy2grl12U_CyKrY",
"session_name": "SESS51ebf8732a20744576a234cf7af43040",
"token": "jkUDb6MsGMHt_mBlGbm02O-lyZq-2nRTqD1OslxtvAg",
"user": {
"uid": "6",
"name": "admin",
…
Now I have a token. Now I upload two picture.
http://test.dd:8083/api/file
Got these responses
{
"fid": "6",
"uri": "http://test.dd:8083/api/file/6"
}
{
"fid": “7”,
"uri": "http://test.dd:8083/api/file/7”
}
Ok, Now I’ll try to create a new TestContent
, and connect these Images to the node.
Ok, The node is created. But the Images isn’t connected to the node. But I didn’t get error message. Why? What’s wrong?
I tried:
[ {fid:6} , {fid:7}]
und: [ { fid: 6 }]
Please give me ideas. Thank you