Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[RELEASED] Drupal API

Discussion in 'Assets and Asset Store' started by bdovaz, Aug 28, 2016.

  1. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    header.png

    Do you manage or want to manage your project content on a CMS like Drupal and want to access that information (users, asset bundles, images, audios, videos, texts, etc.) or generate it (user registration, login, progress, etc.) from Unity?

    A full Drupal API integration. It implements all endpoints available using Services module.

    Asset Store link

    https://www.assetstore.unity3d.com/#!/content/69513

    Online documentation


    https://docs.google.com/document/d/1rRRM4MEzhhm-fhqK7aueRcYvdGlmPB02pmaeAx1NWRs

    Supported Platforms

    It should work in any platform except consoles because it relies on “UnityWebRequest” class that doesn’t work in consoles yet.

    Features
    • Full Drupal 7 Rest API support via Services module (with 100% endpoints implemented).
    • Full object oriented API (you don't deserialize anything, it's already done it for you).
    • Entities raw data it’s always retained to allow extensibility (user custom fields, node custom fields, etc…).
    • It’s really easy to extend the API to user custom created resources with a partial class or extension method (example provided).
    • C# Source code included.
    • Documentation available.
    • Easy integration to your Unity project.
    • Well organized and structured code.
    • Event based. Example: OnUsersRetrieved(IEnumerable<DrupalUserData> users)
    • Fully testable in editor: You can also log Drupal original endpoint url and XML response.
    • Examples available. Includes an example to test the full API with a console view.
      Requires Unity 5.3+ (by default uses UnityWebRequest) but you can make it 5.0, 5.1, 5.2 backwards compatible implementing:
      - IRequest: Interface to make requests. You can use Best HTTP that is backwards compatible.
    screenshot_01.png
    screenshot_02.png
    screenshot_03.png
     
    Last edited: Jan 14, 2018
  2. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    It has been approved!
     
  3. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    257
    Hello ! Does this work with Drupal 8.2+ ?
     
  4. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    It should because I haven't seen any "breaking changes" in Drupal 8 rest module API.

    If not I could fix it because I want to be compatible with Drupal 8.x no matter what version it is.

    Also I have many customers that some of them I'm sure that they use Drupal 8.2 because it was release on October 2016 more or less.
     
  5. coverpage

    coverpage

    Joined:
    Mar 3, 2016
    Posts:
    385
    Hi, from the description, there is an interface to allow the use of best http. Have this been implemented or do I have to implement it myself.

    Btw I think Drupal would make an excellent backend with the restful api and a node based system and easily modified content type (through the admin panel itself).
     
  6. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    You have to implement it yourself but it's really trivial. I can help you if you want.
     
  7. florin-simion

    florin-simion

    Joined:
    Oct 5, 2017
    Posts:
    1
    Hi,

    I really want to purchase this product but I'm a bit confused.Does it work with Drupal 8 or not yet?
    From the description, it looks like is not there yet, but looking at the questions posted here I take that is working.

    Thanks.
     
  8. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    It doesn't work yet. On Drupal 8.2-8.4 are changing many things regarding this and I want to be stable. I have some progress on this but I don't want to publish anything yet.

    If you need Drupal 8, you will have to wait (I can't say a specific date) or do it yourself.
     
  9. Arulbabu

    Arulbabu

    Joined:
    Apr 12, 2013
    Posts:
    13
    Hi N3uRo

    Thanks for the asset. Its great. but i am noob in OOP. I Just need a linear approach example. i tried to understand all the example code but i cant understand the alll the code.... its nice and perfectly documented.

    I need a simple login , and node creation example code snippet. that will be helpful for everyone to understand how to implement. Can u help me in this.

    It will be so helpful if you create any tutorial step by step for just how to do a login and create a node and retrieve a node.
    I hope you got my problem.

    Thank you
     
  10. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    Here you have a complete code example (but please, also read docs because you also need to follow more instructions before getting to this step), if you have any doubt, please post again and I will kindly help you.

    Code (CSharp):
    1.  
    2. // 1. Login
    3.  
    4. DrupalAPI.Instance.OnLoginSucceeded += (sender) => {
    5.     // User is logged in, here we can make request that require user authentication like creating or retrieving nodes
    6. };
    7.  
    8. DrupalAPI.Instance.Login("username", "password");
    9.  
    10. // 2. Create node
    11.  
    12. DrupalAPI.Instance.OnNodeCreated += (sender, nid, uri) => {
    13.     // Here we know that our node has been created and we can retrieve the node id (= nid).
    14. };
    15.  
    16. uint uid = DrupalAPI.Instance.UserData.Uid; // In case we want to create it with the logged in user.
    17. string title = "My title";
    18. string type = "article"; // The node type
    19.  
    20. Dictionary<string, string> extraFields = new Dictionary<string, string> { // A list of custom fields created form that node type
    21.     { "field_my_custom_field", "test value" }
    22. };
    23.  
    24. DrupalAPI.Instance.CreateNode(uid, title, type, extraFields);
    25.  
    26. // 3. Retrieve node
    27.  
    28. DrupalAPI.Instance.OnNodeRetrieved += (sender, node) => {
    29.     // Here we have our retrieved node
    30. };
    31.  
    32. uint nid = 1; // or whatever node ID is that we can get from "OnNodeCreated" event.
    33.  
    34. DrupalAPI.Instance.GetNode(nid);
    35.  
     
  11. Arulbabu

    Arulbabu

    Joined:
    Apr 12, 2013
    Posts:
    13
    Thanks @N3uRo

    your code snippet Helped a lot. I can login and fetch the user data now. but along the reslut i have got two errors . can u explain why i am getting these errors?

    a1.PNG


    a2.PNG

    and my second question is I want the raw data as a JSON. so i tried to uncomment the // Json line in format enum. and i selected json format. but i didnt get the reslut. should i change anything else to get the reslut as json .

    Thanks
    Arul
     
  12. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    Have you read online docs where it says that you need to enable specific resources depending on the endpoints that you are using? What you are facing you can see it marked as read in my online docs.

    And regarding the second question, JSON doesn't work but because Unity's JSON serialization API it's very limited and doesn't serialized some data formats so it's unusable (that's why I have it commented). You need to use XML format.
     
  13. Arulbabu

    Arulbabu

    Joined:
    Apr 12, 2013
    Posts:
    13
    Hi @N3uRo

    Yes . I have read and followed the online document. here i am not using my code. I am using your example.

    and for drupal....

    1. I have installed drupal
    2. Installed services module and rest server
    3. created "api" endpoint
    4. enabled all the sources. (node ,user, all resources....)
    5. gave the permissions.

    in Unity

    1. just opend your example
    2. changed to the APi endpoint to my site (http://www.donvia.in/drupal/api)
    3. just run the application

    I have got these error even before i click any button
    a11.PNG

    can u tell me what i am missing..

    Thanks
    Arul
     
  14. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    I see what is your problem. Normally you would host drupal on:

    http://www.donvia.in

    In your case you have it on a subfolder:

    http://www.donvia.in/drupal

    So that's what is causing your issues.

    I'm sending you privately a patch fixing this specific case.
     
  15. Arulbabu

    Arulbabu

    Joined:
    Apr 12, 2013
    Posts:
    13
    Thanks @N3uRo . Got The fix . :)

    Arul
     
  16. AspiBuddy

    AspiBuddy

    Joined:
    Jan 8, 2018
    Posts:
    2
    Hi N3uRo,

    Like Arulbabu I'm new to Unity (not a Drupal Expert but a strong user :)). On my side I don't want to create a Drupal content but display a drupal content when a user is loggedin.
    My approach is to connect from Unity app and can display different content the user is able to read with its permissions. Is there any chance to get some code from you in this way or perhaps a simplest code just for displaying content in Unity interface?

    Thanks in advance.

    François
     
  17. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    Sorry, also you need to set "siteEndpoint" on inspector to
    You should use the example provided above without the CreateNode method and go for GetNode or GetNodes methods.

    In that methods you need to provide some parameters and filters that you have examples in my asset and that are documented on online docs.

    If you have any specific questions please post it here.

    Thanks.
     
  18. Arulbabu

    Arulbabu

    Joined:
    Apr 12, 2013
    Posts:
    13
  19. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    You need to understand that my asset it's a Drupal REST API that exposes generic endpoints. What you are asking is a specific case on your project.

    You have some approaches to achieve what you want, I'm going to try to help you:

    1. Implement a custom resource on your server

    WIth this, you can expose new endpoints that will handle multiple requests (GET,POST,etc.) and you will code the input handle and the output that you expose.

    You then need to code in C# the endpoints also. In CustomExampleResources script you can see a starting point.

    More info: https://www.drupal.org/node/783460

    2. Use Services Views module with a Drupal View

    With this module you can create a view that will return a XML response.

    You then need to code in C# the endpoints also. In CustomExampleResources script you can see a starting point.

    More info: https://www.drupal.org/project/services_views

    3. Try to obtain your data with GetNodes method

    If your view it's simple you can create a query with GetNodes method. Example:

    Code (CSharp):
    1. uint page = 0;
    2. string[] fields = new string[] { "uid", "title" }; // Return only that two fields
    3. Dictionary<string, string> parameters = new Dictionary<string, string> {
    4.     { "type", "test" }, // Filter "test" node types
    5.     { "status", "1" } // Only query published nodes
    6. };
    7. uint pageSize = 20;
    8.  
    9. GetNodes(page, fields, parameters, pageSize);
     
  20. Arulbabu

    Arulbabu

    Joined:
    Apr 12, 2013
    Posts:
    13
    Hey @N3uRo Thankyouverymuch. I never saw a quick help like this before here in asset store. :)

    now i understand what i have to do. Thankyou.
     
  21. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    I'm glad that you understand it now.

    Thanks for the kind words.
     
  22. AspiBuddy

    AspiBuddy

    Joined:
    Jan 8, 2018
    Posts:
    2
    Hi @N3uRo

    we have a problem displaying node content. All html is broken. So text formatting is not good as we have for example:
    &lt;li&gt; rather than <li>. Is there a way for Unity to interpret html tag in text? well in the end what I want to understand is if this interpretation is on DrupalAPI side or Unity side and how to fix it?

    Thanks in advance for all your helpfull answers!

    François
     
  23. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    Can you paste me your code so I can reproduce it with your hosted API endpoints (if it's public)? I need to see if it's Drupal who is escaping this html or it's on unity side.

    You can send me privately if you want.
     
  24. DragonFlame

    DragonFlame

    Joined:
    Mar 21, 2010
    Posts:
    17
    Hello,
    Thanks for creating this asset, I have been looking for a way for a while now that would allow me to access the login system and data off my website and this is looking like the prefect solution.

    I have been having an issue and also have a few questions and wondering if you have any suggestions.

    The issue I have been having is that my game will lock up for around 30 seconds or more when trying to communicated with my site when its in maintenance mode, with your current example just calling "DrupalAPI.Instance.GetLoggedUserDetails();" will lock the application, is there a correct way to communicate with the server or detect that the site is in maintenance mode to avoid this lockup?

    I have also been considering allowing certain users to be allowed to login into the game while in maintenance mode using the Maintenance Exempt module which allows you to pass a query string, is there a way to pass a query such as "DrupalAPI.Instance.GetLoggedUserDetails(query);" or something else I'm not aware of to make this work?

    I have noticed that the game still thinks its logged in even if I take the site down, my thought on this was that I need to continue sending commands to the website until I get no response which might not be a big deal because I want to implement a friends list with online status but I'm not sure if this is the correct or efficient way to do this, what is the correct way to detect if a connection is still established?

    Any help would be much appreciated,
    Thanks for your time.
     
  25. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    I don't have tried Drupal services module in maintenance mode to see if it works or not as it's a very rare case. In case it works you have two solutions:

    1. Use my "GetVariable" method and ask for 'maintenance_mode' variable that should return a 1 or 0. More information: https://www.drupal.org/forum/support/theme-development/2011-05-31/determine-if-in-maintenance-mode

    2. Create a custom resource on your own: https://www.drupal.org/node/783460

    For the user session persistance you should know:

    - "GetLoggedUserDetails" method uses Drupal services module "system > connect" resource that determines if the current users cookie exists and it's still valid.
    - You have a "Logout" method to correctly make a logout process.
     
  26. DragonFlame

    DragonFlame

    Joined:
    Mar 21, 2010
    Posts:
    17
    Thanks for the reply.

    Unfortunately using GetVariable as a solution doesn't work, "GetVariable("maintenance_mode", "0")" and "GetLoggedUserDetails()" or any function called while in maintenance mode will cause the game to lock up for a long time.

    I already tried the "GetLoggedUserDetails" method but it will always return the anonymous user when logged in.
    Here is a basic script that I tested it on:

    Code (CSharp):
    1. float time = 0.0f;
    2. float timeInterval = 15.0f;
    3.  
    4. void Start () {
    5.    DrupalAPI.Instance.Login("test", "password");
    6. }
    7.  
    8. void Update () {
    9.    if(DrupalAPI.Instance.IsLoggedIn) {
    10.       time += Time.deltaTime;
    11.       if(time > timeInterval) {
    12.          time = 0;
    13.          DrupalAPI.Instance.GetLoggedUserDetails();
    14.       }
    15.    }
    16. }
    Why would "GetLoggedUserDetails" return anonymous user when the login is successful and "IsLoggedIn" is continuously returning true?
     
  27. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    If you see my code you would see that "IsLoggedIn" does not connect to the server in order to retrieve the value. IsLoggedIn will always return true after a successful login and return false after a successful logout. So you can't rely on "IsLoggedIn" for maintenance mode.

    Your case it's really difficult to achieve because my asset relies on Drupal Services module and as you can see when in maintenance mode it doesn't work and I suppose it's not that module fault but Drupals fault.

    They have requested years ago without any luck:

    https://www.drupal.org/project/services/issues/830302

    I see a mention to the module you said "maintenance_exempt" where you can define a query string variable to access the website but I see a very dangerous approach because that variable always works. I mean it will also work when you navigate your page with a browser despite of being in maintenance mode.

    If you want to use it I see that you could add that variable manually in my "DrupalAPI.cs" script where you see Get/Post/Put/Delete methods. You can append that variable to "string path" variable and test it.
     
  28. DragonFlame

    DragonFlame

    Joined:
    Mar 21, 2010
    Posts:
    17
    Hello again,

    That's disappointing to hear the maintenance problem is with REST and Drupal, I will have to think of another solution.
    I also don't like the idea of using "maintenance_exempt" but I think it may be the only solution until I think of something better.
    Thanks for this information.

    I'm sorry maybe I wasn't clear with my explanation, the maintenance mode and login issue are two separate problems, I only call "IsLoggedIn" after a successful login when not in maintenance mode, I am more confused as to why "GetLoggedUserDetails" with a successful login returns the anonymous user and not the logged in user, shouldn't it retrieve the information of the currently logged in user?
     
  29. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    You are right, I don't know what broke it if it was a services module update or something like that but in order to fix it you need to go to "DrupalAPI.System.cs > GetLoggedUserDetails" method and change "Post(true" to "Post(false".
     
  30. DragonFlame

    DragonFlame

    Joined:
    Mar 21, 2010
    Posts:
    17
    Thank you this seems to fix the issue with "GetLoggedUserDetails" failing right away after login.

    I'm getting a new error "CSRF validation failed" after a few calls to "GetLoggedUserDetails" which I have been reading is probably because I was not using tokens, is this true?

    I was not using tokens because I'm getting the same error Arulbabu was getting because my test environment is in a sub directory.
    "Error: Resource not found: http://localhost/services/session/token"

    If you think it will fix the "CSRF validation failed" error can you please post me the fix that you sent Arulbabu.
     
  31. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    If you want to completely disable CSRF token validation you have instructions in the asset docs:

    https://docs.google.com/document/d/...lmPB02pmaeAx1NWRs/edit#heading=h.281309l77f9x

    Regarding that subdirectory issue I have sent you the fix via a PM.
     
  32. DragonFlame

    DragonFlame

    Joined:
    Mar 21, 2010
    Posts:
    17
    Your patch fixed the issue perfectly, thanks very much for all your help.
     
  33. CosmicLab2

    CosmicLab2

    Joined:
    Aug 3, 2013
    Posts:
    33
    Does this work with Drupal 7 & Internationalization (i18n)? We want to be able to retrieve Drupal node content in the correct language depending on language choices made in Unity. Thanks
     
  34. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    You need to check if Drupal services module allows that but I think that it's supported. Anyway in case is not you can create your own custom endpoints (resources) and return the information you want specifically.
     
  35. CosmicLab2

    CosmicLab2

    Joined:
    Aug 3, 2013
    Posts:
    33
    Thanks for the quick reply. I'll try it out soon then
     
  36. Lucid-Amusement

    Lucid-Amusement

    Joined:
    Jan 7, 2015
    Posts:
    23
    @N3uRo

    Thanks for the great asset, it seems to be exactly what I'm looking for, and I am able to create and retrieve new users and nodes. However, when attempting to update any user or node record I am getting a Error: HTTP/1.1 406 Not Acceptable response from the server. I do not have mod_security enabled or installed.

    Any help would be greatly appreciated.
     
  37. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    It's because on some Unity version they changed something that broke PUT methods. Here is the fix:

    1. Open "DefaultWebRequest.cs"
    2. Paste below:

    The following code:

     
  38. Lucid-Amusement

    Lucid-Amusement

    Joined:
    Jan 7, 2015
    Posts:
    23
    @N3uRo -- That fixed it =) tyvm!
     
  39. Lucid-Amusement

    Lucid-Amusement

    Joined:
    Jan 7, 2015
    Posts:
    23
    @N3uRo How do I go about accessing custom node fields after I have retrieved the DrupalNodeData object from OnNodeRetrieved event?
     
  40. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    A node can have N fields with different data structure as there are fields that can be installed as a Drupal module and are not included in Drupal core. That is why in all types of data I expose a field called "RawData" that returns in a string the complete response of the server so that you can parse it by hand and get the data that interest you.

    Run a "Debug.Log(node.RawData);" and your will see it.
     
  41. Lucid-Amusement

    Lucid-Amusement

    Joined:
    Jan 7, 2015
    Posts:
    23
  42. Lucid-Amusement

    Lucid-Amusement

    Joined:
    Jan 7, 2015
    Posts:
    23
    @N3uRo - I just attempted to update an existing node to change its uid and a user reference, and am getting the following error;
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. VGRewardsManager.OnNodeRetrieved (Drupal.DrupalAPI drupalAPI, Drupal.DrupalNodeData node) (at Assets/_Game/Systems/Vegas Games/VGRewards/Scripts/MonoBehaviors/VGRewardsManager.cs:192)
    3. Drupal.DrupalAPI.<GetNode>b__194_0 (System.String response) (at Assets/DrupalAPI/Source/Drupal/Node/DrupalAPI.Node.cs:93)
    4. Drupal.DrupalAPI+<>c__DisplayClass101_0.<Process>b__0 (System.String r) (at Assets/DrupalAPI/Source/Drupal/DrupalAPI.cs:382)
    5. Drupal.DrupalAPI.Process (System.String uri, System.String error, System.String response, System.Int64 responseCode, System.Action`1[T] successCallback, System.Action`1[T] errorCallback) (at Assets/DrupalAPI/Source/Drupal/DrupalAPI.cs:314)
    6. Drupal.DrupalAPI.Process (System.String uri, System.String error, System.String response, System.Int64 responseCode, System.Action`1[T] successCallback, System.Action errorCallback) (at Assets/DrupalAPI/Source/Drupal/DrupalAPI.cs:374)
    7. Drupal.DrupalAPI.Process (Drupal.IRequest request, System.Action`1[T] successCallback, System.Action errorCallback) (at Assets/DrupalAPI/Source/Drupal/DrupalAPI.cs:369)
    8. Drupal.DrupalAPI+<DoGet>d__90.MoveNext () (at Assets/DrupalAPI/Source/Drupal/DrupalAPI.cs:220)
    9. UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
    Oddly, tracing this back leads to the line of code you had me change for my previous 406 Error in messages 36 & 37 ( request.uploadHandler.contentType = "application/x-www-form-urlencoded"; (line #10 below));
    Code (CSharp):
    1.        private IEnumerator DoPut(MonoBehaviour context, string path, Dictionary<string, string> parms, Dictionary<string, string> headers, Action callback)
    2.        {
    3.            if (request != null)
    4.            {
    5.                request.Dispose();
    6.                request = null;
    7.            }
    8.  
    9.            //request = UnityWebRequest.Put(path, UnityWebRequest.SerializeSimpleForm(parms));
    10.            request.uploadHandler.contentType = "application/x-www-form-urlencoded";
    11.  
    12.            yield return context.StartCoroutine(Send(context, request, headers, callback));
    13.        }
    Please assist :)
     
  43. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    Why do you have commented that line? If you read my previous post I said to paste it BELOW that line not replace it. Having that line replaced you are not doing a any request nor sending any parameters.

    Also I don't understand the relation between a node update and "NodeRetrieved" event. That event is for when you call GetNode not UpdateNode.
     
  44. Lucid-Amusement

    Lucid-Amusement

    Joined:
    Jan 7, 2015
    Posts:
    23
    @N3uRo Ahh-ha! :) I misunderstood you, thank you for the clarification.

    To answer your question, for this particular case, when a node of a specific type is updated, that node is retrieved from the server to verify the data was saved correctly.
     
    Last edited: Mar 6, 2019
  45. Lucid-Amusement

    Lucid-Amusement

    Joined:
    Jan 7, 2015
    Posts:
    23
    @N3uRo

    FIrst off, thanks so much for your excellent support so far.
    Currently, everything is now working great in the UnityEditor, but in a Standalone build I'm getting the following;


    and in the Android build I'm seeing;

    ...and occasionally the CSRF error appears in the mobile build as well.

    Any suggestions?
     
  46. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    To be able to help you more effectively I would need access to your Drupal to be able to run tests otherwise I will go blind.

    By access I mean a user who can log in from the API and who can do the operations you are mentioning.

    Send it to me by MP.

    Thanks.
     
  47. Lucid-Amusement

    Lucid-Amusement

    Joined:
    Jan 7, 2015
    Posts:
    23
  48. Lucid-Amusement

    Lucid-Amusement

    Joined:
    Jan 7, 2015
    Posts:
    23
    Thanks for the excellent help @N3uRo, it's most appreciated.

    For everyone else, my problem appears to be the result of a conflict with another 3rd-party plugin.
     
  49. arturmandas

    arturmandas

    Joined:
    Sep 29, 2012
    Posts:
    197
    I just bought your asset. It is pure gold! I have no prior knowledge of Drupal, REST very minimal, and was able to set this all up very quickly.

    One thing that bothers me (probably sth is not set up properly by me), is that, I get this error:
    Shouldn't it be referring to Resource not found: http://www.mywebsite.com/api/services/session/token (I followed the nomenclature from the official doc).

    Apart from that the connection seems to be working - I am able to login and fetch nodes.

    Best regards
     
  50. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    687
    If you open a web browser and go to "http://www.mywebsite.com/services/session/token" (without "api" preffix because that preffix it's of your previously created server and "services/session/token" it's a core resource exposed by services module) what response are you getting?

    That should be the correct url that it's exposed by the services module.

    You can see in this tutorial that states the same:

    https://julian.pustkuchen.com/en/drupal-7-services-3-session-authentication-csrf-token

    Edit: Maybe you didn't enabled "user > token" resource in services module?