Jump to content

Recommended Posts

Hi,

Gain Capital API documentation: CIAPI Reference: HTTP Services: Price Alerts.

Am able to access PriceAlert json string using GET. No problem.

Am NOT able to POST for save, whether updating existing PriceAlert or creating new PriceAlert. (I am able to perform other POST actions throughout API).

Have tried changing fields (only one change per attempt): Criterion; Direction; FillRate; Expiry; ExpiryDate; Comment.

  • using Key:Value pairs
  • posting json string in Body

Have tried using:

  • Postman
  • VBA

Error: 400 Bad Request: {"HttpStatus":400,"ErrorMessage":"Fill rate must be greater than zero.","ErrorCode":12014}.

What in blazes am I missing?

Regards,

Bryson.

Share this post


Link to post

Hi Bryson,

The returned error message is complaining about the Fillrate parameter. Assuming it is not sending us on a wild goose chase, what value did you use and on what market? Perhaps if you paste in the request payload you are sending I can use that to test your call. 

As an example, a successful request payload I used to create a new price alert on the USD/JPY market at a price level of 107.00 is:

{
    "alertId": 0,
    "direction": 1,
    "expiry": 1,
    "fillRate": 107,
    "marketId": 401138125,
    "notificationMethod": null,
    "comment": null,
    "criterion": 2,
    "expiryDate": null,
    "emailAddress": "x@x.com"
}

Kind Regards, PM

Share this post


Link to post

Thanks for your help. Turns out the thing that I was missing was that I was putting the payload as Parameters. When I moved the data to the body of the json send it worked just fine.

 I have checked the API docs again, and I note that the documentation refers to parameters, but in this case makes no mention of placing the contents in the json body. Further, the documentation does not provide an example in this case as it does for many other scripts. I have found the examples in the past very useful. Would recommend an update to make that particular reference page a little clearer!

Appreciate the help all the same. Your example above is what prompted me to try placing the data in the body.

Regards,

Bryson.

Share this post


Link to post

Hi Bryson,

Many thanks for updating us and we're happy to hear that you solved it.

We very much appreciate your feedback regarding the API documentation - it is very helpful! :) A note has been made to improve it along the lines you have suggested at the next documentation refresh. 

Kind Regards, PM

Share this post


Link to post

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
×