Developer Guide
Authentication
    In order to work with Magentrix REST API, you first need to get a session token using below authentication methods.
    Then you can use the Session ID as a Bearer token to perform other actions such as Creating or Updating records.
     

    Authentication

    This endpoint does not support sliding expiration. However, after authentication, a session ID is provided. This session ID must be set as Authorization header in every request (as Bearer token); cookies are not required. The client application is responsible for making sure that the session ID is not expired when making request calls. In order to perform the authentication the following HTTP POST call must be made:

    POST https://<your-portal-domain>/rest/2.0/createsession
     -H "Content-Type: application/json"
     -H "Accept: application/json"
     -d { 
          "UserName":"<username>",     
          "Password":"<password>" 
        }
    


    Login Success

    {
      "SessionId": "<sessionId>",
      "DateIssued": "<issueDate>",
      "ValidUntil": "<validUtilDate>",
      "IsSuccess": true,
      "Errors": []
    }

    Date sample: 2019-11-21T21:25:28.0583347Z

    Login Failed

    {
      "SessionId": null,
      "DateIssued": "2019-11-22T18:34:50.4506867Z",
      "ValidUntil": "0001-01-01T00:00:00",
      "IsSuccess": false,
      "Errors": [
        {
          "Code": null,
          "PropertyName": null,
          "Message": "Login failed."
        }
      ]
    }

     

     

    Legacy Authentication Method

    This method is still supported, however it will be deprecated in future.

    POST https://<your-portal-domain>/rest/2.0/login
      -H "Content-Type: application/x-www-form-urlencoded"
      -H "Accept: application/json"
      -d un=<username>&pw=<password>
    

    Sample of body payload (form submission):
    un=<username>&pw=<password>
     

    Here's an example of a response body in JSON format:

    {
        "DateIssued": "2014-03-04T18:28:43.5377858Z",
        "ValidUntil": "2014-03-04T22:28:43.5377858Z",
        "Errors": [],
        "IsSuccess": true,
        "SessionId": "<sessionid>"
    }
     

    Here's an example of the response body if the login failed:

    {
        "DateIssued": "2014-03-04T18:28:43.5377858Z",
        "ValidUtil": null,
        "Errors": [
            {
                "Message": "Login failed.",
                "PropertyName": null
            }
        ],
        "IsSuccess": false,
        "SessionId": null
    }