Welcome to the Linux Foundation Forum!

Lab 4 not quite working - cant add data

gadzooksgadzooks Posts: 6
edited June 2017 in LFD232 Class Forum

Hi all,

I have managed to get the Roster. jar file onto PWS and it seems to be working fine. However in Lab 4 we are asked to add data to the application. I have tried the following and it is returning an error. I am trying this through a Windows Command prompt. I think the issue is to do with the PATH. I have tried all the following:

https:\\roster-beauish-gesticulator.cfapps.io OR




C:\Users\PG\CF>cf app roster

Showing health and status for app roster in org xxxxx / space development as xxxxxxxxxxxxx



requested state: started

instances: 1/1

usage: 1G x 1 instances

urls: roster-beauish-gesticulator.cfapps.io

last uploaded: Tue Jun 13 10:50:14 UTC 2017

stack: cflinuxfs2

buildpack: container-certificate-trust-store=2.0.0_RELEASE java-buildpack=v3.15-offline-https://github.com/cloudfoundry/java-buildpack.git#a3a9e61 java-main open-jdk-like-jre=1.8.0_121 open-jdk-like-memory-calculator=2.0.2_RELEASE spring-auto-reconfiguration=1.10...

     state     since                    cpu    memory         disk           details

#0   running   2017-06-13 11:51:37 AM   0.5%   567.2M of 1G   154.7M of 1G

C:\Users\PG\CF>cf curl "roster-beauish-gesticulator" -H "Content-Type: application/json" -X POST -d "{"firstName":"foo", "lastName": "bar"}"


   "description": "Unknown request",

   "error_code": "CF-NotFound",

   "code": 10000



  • amatelliniamatellini Posts: 15
    edited June 2017

    Try this:

    curl -H "Content-Type: application/json" -X POST -d '{"firstName":"foo", "lastName": "bar"}' http://roster-beauish-gesticulator.cfapps.io/people

    All on the same line.


  • TimHarris123TimHarris123 Posts: 8
    edited June 2017

    Yes Amatellini - that looks good.  Using linux "curl" is correct for accessing this endpoint, not "cf curl" in this case.  

  • amulleramuller Posts: 14
    edited June 2017


    I had some problems to run the curl command properly under Windows.

    This syntax should be OK:

    curl -H "Content-Type: application/json" -X POST -d "{\"firstName\":\"foo\",\"lastName\":\"bar\"}" http://roster-presageful-creature.cfapps.io/people



  • amatelliniamatellini Posts: 15
    edited June 2017

    Hi Anthony, the syntax is correct. It shold work on Windows, at least it worked for me. What kind of problem do you have?

    I suggest you to install cygwin, so you can use linux syntax. 



  • gadzooksgadzooks Posts: 6
    edited June 2017


    Many thanks for your suggestions so far but this still isnt workig for me. I am not sure if this is because it is a Windows prompt and this is a Linux command thing, a syntax mistake by myself or something else.

    If I try: 

    curl -H "Content-Type: application/json" -X POST -d "{\"firstName\":\"foo\",\"lastName\":\"bar\"}" http://roster-beauish-gesticulator.cfapps.io

    'curl' is not recognized as an internal or external command,

    operable program or batch file.


    If I try:

    cf curl -H "Content-Type: application/json" -X POST -d "{\"firstName\":\"foo\",\"lastName\":\"bar\"}" http://roster-beauish-gesticulator.cfapps.io


       "description": "Unknown request",

       "error_code": "CF-NotFound",

       "code": 10000



    I have tried intalling cygwin but after installing cygwin and using the Developer libraries that include curl I find there is a known cygwin bug preventing Windows users from using curl. I am a bit stuck.

    Should I try different syntax commands in Windows prompt, or should I install Linux?




  • gadzooksgadzooks Posts: 6
    edited June 2017

    Sorry, one more that I might add. If I try ' cf curl' then it seem to work and I get the following:

    cf curl

    Incorrect Usage: the required argument `PATH` was not provided


       curl - Executes a request to the targeted API endpoint


       cf curl PATH [-iv] [-X METHOD] [-H HEADER] [-d DATA] [--output FILE]

       By default 'cf curl' will perform a GET to the specified PATH. If data

       is provided via -d, a POST will be performed instead, and the Content-Type

       will be set to application/json. You may override headers with -H and the

       request method with -X.

       For API documentation, please visit http://apidocs.cloudfoundry.org.


       cf curl "/v2/apps" -X GET -H "Content-Type: application/x-www-form-urlencoded" -d 'q=name:myapp'

       cf curl "/v2/apps" -d @/path/to/file


    ......more stufff that I copy from the Windows promp

  • amatelliniamatellini Posts: 15
    edited June 2017

    Hi, cf curl is only for query cf api.

    You need to install curl for windows, or cygwin (I assure you that it works), or git bash (that works to).

    For windows you can download curl at this link:

    https://bintray.com/artifact/download/vszakats/generic/curl-7.54.1-win64-mingw.7z   (source https://curl.haxx.se/download.html)

    you can extract it with winrar or 7zip. You need only the bin folder.

    Then open a Windows command prompt and write something like:

    curl -H "Content-Type: application/json" -X POST -d "{\"firstName\":\"foo\",\"lastName\":\"bar\"}" http://roster-presageful-creature.cfapps.io/people

    If you use cygwin/git bash open the bash terminial and write something like:

    curl -H "Content-Type: application/json" -X POST -d '{"firstName":"foo", "lastName": "bar"}' http://roster-beauish-gesticulator.cfapps.io/people






Sign In or Register to comment.