Jump to content
  • 0

Failing to Close deal with API validation.null-not-allowed.request


Guest sam4

Question

Hi, 

 

I'm making a Node.js program and just trying to open and close a position using the API. 

I'm making a delete request to 

https://demo-api.ig.com/gateway/deal/positions/otc

with the following data: 

{"direction":"SELL","size":1,"orderType":"MARKET","dealId":"DIAAAABNP77WXAT"}

and I'm getting back "validation.null-not-allowed.request" the weird thing is I try it with the api companion and it works.

Apparently the error means that something is malformed in the request but I've got absolutely no clue. I've tried changing size to be a string not an int, and I've tried using "_method":"delete" and making a post request as I've seen forum posts indicating that should work as an alternative to making a delete request but neither work. 

 

Any help would be greatly appreciated. 

Link to comment

2 answers to this question

Recommended Posts

  • 0

Apparently the DELETE request does not work.

You have to use a POST request instead. 

In the POST request, provide a header "_method" with the value "DELETE".

With curl you would specify the header as follows.

-H "_method: DELETE"

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • General Statistics

    • Total Topics
      21,662
    • Total Posts
      91,985
    • Total Members
      41,956
    • Most Online
      7,522
      10/06/21 10:53

    Newest Member
    MrNarejo
    Joined 29/03/23 14:12
  • Posts

    • #EURJPY: Detailed Structure AnalysisHere are my latest structure analysis for ⚠️EURJPY.Support 1: 138.80 - 139.25 areaSupport 2: 137.38 - 138.18 areaResistance 1: 143.19 - 143.6 areaResistance 2: 145.00 - 145.58 areaResistance 3: 146.40 - 146.7 areaConsider these structures for pullback/breakout trading.
    • #USDCAD: Important Breakout   USDCAD broke and closed below a solid horizontal demand cluster on a daily. The broken structure turned into resistance now.   Probabilities will be high to see a bearish move from that. Goals will be 1.356 / 1.346 For Additional confirmation use: the best mt4 indicators
    • Dollar Index (#DXY): Key Levels to Watch This WeekHere is my latest structure for Dollar Index.Resistance 1: 103.11 - 103.63 areaResistance 2: 104.74 - 105.1 areaResistance 3: 105.667 - 105.88 areaSupport 1: 100.82 - 100.88 areaConsider these structures for pullback/breakout trading.For Additional confirmation use: Swing Trading Indicators
×
×
  • Create New...