Malformed url module 2 milestone 2

while trying to test return json from curl I am getting this message
crio-user@divyashahi139:~/workspace/divyashahi139-ME_QMONEY$ curl ‘//api.tiingo.com/tiingo/daily/"here is m y symbol "/prices?“here is my opening date”=&“here is my closing date”=&token="Here is my generated token’
curl: (3) malformed
May anyone suggest what’s going wrong from message although it’s clear that my url request is not appropriate but I am unable to fix it

@akashchhetri @shoryajain

you need to wite it as startdate=“date”

1 Like

Hi, you need to convert it into a proper cURL command. Maybe this will help you.

curl -X GET -H ‘Content-Type: application/json’ 'https://api.tiingo.com/tiingo/daily/"here is m y symbol "/prices?startDate=“here is my opening date”&token="Here is my generated token’

You need to add the right headers, right request type and specifiy parameters for which you are passing the values. I have deliberately left the closing date part, for you to figure out as practice.

okay please hint if using &of in request url is ok

& is right but after that you need to add the parameter name too before setting its value.

this is the example request I got from link mentioned in references here

https://api.tiingo.com/tiingo/daily/aapl/prices?startDate=2019-01-02&token=b612f3fce6d88a4d09a9d4ce0e715b1538bbbbc8”

here before start date there is no & but before token there is , I am unable to understand this point, please clearify this

and one more thing the symbol I got is in upper case so will it be taken care of or I need to take care of it

So basically, when you are passing parameters via a url, you use ? before the first parameter and then for every subsequent parameter you use an & to specify that along with the previous parameter, there is another parameter that is being passed.

You can consider ‘&’ like the short form of word ‘and’ which is often used in English, since it specifies that previous parameters and the subsequent parameter are being passed.

1 Like

That isn’t an issue. You don’t need to convert it to lowercase.

okay got it , it should be of form
curl -X GET -H ‘Content-Type: application/json’ ‘https://api.tiingo.com/tiingo/daily/“my symbol”/prices?startDate=“mystart date”&endDate=“myendo date”&token="my token’
am I right?

Yes. This should work.

thank you for attention and time, gone try it :slight_smile:

No problem. If there is any other error will be happy to help.

crio-user@divyashahi139:~/workspace/divyashahi139-ME_QMONEY$ curl -X GET -H ‘Content-Type: application/json’ ‘https://api.tiingo.com/tiingo/daily/AAPL/prices?startDate=2019-01-02&endDate=2020-01-01&token=api_token
[1] 18314
[2] 18315
I am getting this output I don’t think it is right.

You have used the wrong quotes. Here is the correct version.

curl -X GET -H ‘Content-Type: application/json’ ‘https://api.tiingo.com/tiingo/daily/AAPL/prices?startDate=2019-01-02&endDate=2020-01-01&token=token_value

Notice the difference in quotes, rest everything remains same. Also, you should hide your API token. It shouldn’t be shared publicly.

1 Like

thanks @shoryajain will try it now , I got ambiguous result in curl but in code it worked quite well now I am in module 3 will definately try it now to check my mistake :slight_smile:

1 Like

No problem. Best of luck!

Again thank you so much for your time and patience :slight_smile: