Sage300 Node js API

SOLVED

Hello, we built a web Point of sales app and we want to integrate some api from sage300  (sales api, inventory, customer info api). we only want some of our api to integrate with sage300. please how do i start ?

Parents Reply Children
  • 0 in reply to Vega

    below is the response after putting my sage login details

    { "error": { "code": "Unauthorized", "message": { "lang": "en-US", "value": "Authentication error from invalid credentials." } } }

  • 0 in reply to Vega

    this is what i tried to call on sage api

    13.50.206.42/.../index

  • 0 in reply to Vega

    i have also tried the server login details but it did not work, i tried the login details of the sage and it still did not work

  • +1 in reply to oneflare
    verified answer

    Have you followed the instructions for configuring access to the Sage web API? You need to set up the security groups for any user that needs access to the API and you need to give them access to the Sage 300 Web API in each module in security. If you're intending to use the admin user, it doesn't have access to the web API by default. You need to edit both web config files in the \Online\Web and \Online\WebApi folders. Change the setting called AllowWebApiAccessForAdmin to true in each. In the \Online\WebApi web config file I would also set the pagesize to be something like 10000 as well.

    Restart IIS or the app pool once you have done all that. Then open the browser on the Sage server and go to http://localhost/Sage300WebApi and click on the blue button to open the swagger UI. Once it has loaded, you can easily test. Do something like go to ARCustomers and expand it. On the first GET, expand that, change the company name from SAMLTD to whatever company you want, and click Try it out! When it prompts for the user name and password, put the Sage 300 user name and password for whoever you're going to use for web API access and make sure you type them in upper case. Then when it has done you should get some customer data back in the Response Body box. If you get an error, paste it in here and we can look further.

  • 0 in reply to Vega

    its still the same thing after doing all this

  • 0 in reply to Vega

    what else am i suppose to do?

  • +1 in reply to oneflare
    verified answer

    When you open the Swagger UI, you click the blue button, then you wait for the endpoints to load. Then you expand ARCustomers (for example), then open the first GET option and in that screen you will see a company text box. By default, it usually has SAMLTD, and that is what is shown on yours. Your screenshot shows you trying to configure SAMDAT. So, your Swagger UI is trying to make a connection to SAMLTD and you appear to be configuring SAMDAT for web API access. The quick option is when you open the Swagger UI, when you expand the endpoint you wish to use, just overwrite the company name with the one you have configured for access in Sage. If you want it to default to that company then edit the web config files and look for SAMLTD and change it to the one you want.

  • 0 in reply to Vega

    Thanks for the response, I've done that and I can now make request to the endpoints on the swagger ui.

    I tried making a request to any sage api with the given api link with ip address from sage on my nodejs web server but i get unauthorized error. It works fine when I call the apis from the swagger docs provided to us by sage. What could be doing wrong?

  • 0 in reply to oneflare

    If you're trying to connect to the IP address you gave in the earlier posts, it suggests you're looking to call the Sage endpoints over the open internet. I suspect that something is could be stripping the payload headers out. Trying running the requests via Postman and try using Fiddler to trace the request. If the request is working when you are using the Swagger UI, then Sage is working correctly. The issue is most likely outside of Sage now.

  • 0 in reply to Vega

    Thanks for the response the other day, I really appreciate that.
    Now, I'm to send data gotten from the response object upon creating a sale in my software to sage.

    Firstly, I can't find the endpoint on sage that accepts payload to create a sale, also, can I know the required payload to be sent to such endpoint.

    Secondly, to create a customer, from the sage docs on swagger, I would need to create a customer group and also required parameters which isn't available on my software, how do I get such required parameters in the payload.

    Likewise syncing inventories on my software to sage and vice versa.

    Thanks.

  • 0 in reply to Vega

    Hi,
    I'm trying to create a receipt adjustment batch with one of the data in the payload "BatchStatus": "Posted" but I get this error "Batch status cannot be manually changed to POSTINPROGRESS or POSTED. (3620 ARBTA1.C)."

    How can I resolve this?

    Also is there any endpoint that works for posting receipts alone and take the status of the batch from "Open" to "Posted" because taking the BatchStatus: "Open" works but the receipt is not posted.

    Pls how do i resolve this?