LinnSystems / LinnworksNetSDK

Linnworks.net Developers
26 stars 41 forks source link

GetOrder #2

Closed jmawebtech closed 8 years ago

jmawebtech commented 8 years ago

Hi,

I am trying to pull a list of orders from my LinnWorks account. I have some questions:

  1. I am calling http://apps.linnworks.net/Api/Method/AuthorizeByApplication. I did a POST with my appId, app secret and token:

app_install

Inside of my application, I clicked the install link and I received a token. When I call the method, I get a 400 bad request. My URL is https://eu1.linnworks.net/api/Auth/AuthorizeByApplication. Am I posting to the wrong URL?

Here is my request:

POST https://eu1.linnworks.net//api/Auth/AuthorizeByApplication HTTP/1.1 Accept: application/json Content-Type: application/json Host: eu1.linnworks.net Content-Length: 148 Expect: 100-continue Connection: Keep-Alive

applicationId=XX&applicationSecret=XX&token=XX

Response

HTTP/1.1 400 Bad Request Cache-Control: no-cache Pragma: no-cache Content-Type: application/json; charset=utf-8 Expires: -1 Server: Microsoft-IIS/8.5 Access-Control-Allow-Origin: Access-Control-Allow-Headers: Access-Control-Allow-Credentials: false X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Access-Control-Allow-Headers: Authorization, Origin, X-Requested-With, Content-Type, Accept, Accept-Language Access-Control-Allow-Methods: GET, POST, OPTIONS Access-Control-Allow-Credentials: true Date: Sat, 06 Feb 2016 17:52:13 GMT Content-Length: 37

{"Message":"The request is invalid."}

  1. Inside of my LinnWorks, I cannot see the app installed under my applications. Is there an approval process for new apps?
  2. Is it possible to pull a list of orders by the date modified field? If so, please send me a sample request.
LinnSystems commented 8 years ago

Hi @jmawebtech,

It looks like you're not using the correct content type to authorize your request. You should use the content-type "application/x-www-form-urlencoded" as defined in the following file:

https://github.com/LinnSystems/LinnworksNetSDK/blob/master/Linnworks/src/net/LinnworksAPI/Factory.cs

You also appear to be using eu1 as the server. For authorization requests, you should always use the api.linnworks.net server.

You shouldn't have any issues with this if you're using the code provided here, as it should set the content type correctly. Would you be able to confirm this?

jmawebtech commented 8 years ago

Yes, that works thanks.

abjalil commented 7 years ago

sir plz send me the integration code of API

abjalil commented 7 years ago

hi how we update linnworks price from local data base using API