wiki:GEC17Agenda/GettingStartedWithGENI_III_GIMI/Procedure/TrackIssues/ExpServiceNew

When I do a POST to the experiment service, I can see that the user has been added to a project

The POST logs are

Saving JSON to file: /home/dbhat/exptest/user.json
{
  "type": "user",
  "uuid": "01340c9f-b67c-4c39-9b04-7e6ceefaaf33",
  "href": "/users/01340c9f-b67c-4c39-9b04-7e6ceefaaf33",
  "name": "geni-dbhat",
  "projects": [
    {
      "uuid": "87702cd7-31c2-4d9c-b768-d25bab4c477b",
      "href": "/projects/87702cd7-31c2-4d9c-b768-d25bab4c477b",
      "name": "GIMITesting",
      "type": "project",
      "users": [
        {
          "uuid": "2334dd04-cab3-4bf4-8302-eb8514e70215",
          "href": "/users/2334dd04-cab3-4bf4-8302-eb8514e70215",
          "name": "geni-dbhat",
          "type": "user"
        },
        {
          "uuid": "06b0e8e9-55ad-4c64-bb80-dda04e185e02",
          "href": "/users/06b0e8e9-55ad-4c64-bb80-dda04e185e02",
          "name": "geni-cwang1",
          "type": "user"
        },
        {
          "uuid": "0fe9d7d5-6770-4ec2-a94b-593129063f1a",
          "href": "/users/0fe9d7d5-6770-4ec2-a94b-593129063f1a",
          "name": "geni-dbhat",
          "type": "user"
        },
        {
          "uuid": "ebfb6cf7-e882-4772-a270-5ed15bcc818c",
          "href": "/users/ebfb6cf7-e882-4772-a270-5ed15bcc818c",
          "name": "geni-dbhat",
          "type": "user"
        },
        {
          "uuid": "01340c9f-b67c-4c39-9b04-7e6ceefaaf33",
          "href": "/users/01340c9f-b67c-4c39-9b04-7e6ceefaaf33",
          "name": "geni-dbhat",
          "type": "user"
        }
      ],
      "experiments": [
        {
          "uuid": "e08d9ea6-3acc-45af-a5b3-2f9f3d768f8f",
          "href": "/experiments/e08d9ea6-3acc-45af-a5b3-2f9f3d768f8f",
          "name": "dbhat-exptest18-3-2013-07-18T12:55:54",
          "type": "experiment"
        },
        {
          "uuid": "2e1c2710-3875-41aa-b07e-777e335cf8ab",
          "href": "/experiments/2e1c2710-3875-41aa-b07e-777e335cf8ab",
          "name": "cwang1-vlc-test-exp-2013-07-18T12:56:08",
          "type": "experiment"
        },
        {
          "uuid": "285970c4-cf94-4840-b82a-025a157115ea",
          "href": "/experiments/285970c4-cf94-4840-b82a-025a157115ea",
          "name": "dbhat-exptest2-2013-07-18T13:52:55",
          "type": "experiment"
        },
        {
          "uuid": "a410c195-4178-4cbf-9323-49bb3eb599d5",
          "href": "/experiments/a410c195-4178-4cbf-9323-49bb3eb599d5",
          "name": "dbhat-exptest4-2013-07-18T14:10:57",
          "type": "experiment"
        }
      ]
    }
  ]
}
Saving JSON to file: /home/dbhat/exptest/proj.json
[
  {
    "uuid": "84b91ba0-6b00-485a-b434-bb2e36d8040c",
    "href": "/projects/84b91ba0-6b00-485a-b434-bb2e36d8040c",
    "name": "GIMITesting",
    "type": "project"
  }
]
Saving JSON to file: /home/dbhat/exptest/experiment.json
{"exception":{"code":403,"reason":"Unsupported Method"}}Saving JSON to file: /home/dbhat/exptest/slice.json
{"exception":{"code":403,"reason":"Unsupported Method"}}Values:dbhat GIMITesting dbhat-exptest6-2013-07-18T14:17:08 YR8DENLDbDjxulo /geniRenci/home/geni-dbhat/manifests-2013-07-18T14:17:08 dbhatlabwiki 

But When I do

 curl http://emmy9.casa.umass.edu:8002/users/geni-dbhat/

It does not list the project that I just added it to.

dbhat@bua-1159:/usr/local/bin$ curl http://emmy9.casa.umass.edu:8002/users/geni-dbhat/
{
  "type": "user",
  "uuid": "3b4a2f26-b82b-46c8-9634-c8c143dcdf22",
  "href": "/users/3b4a2f26-b82b-46c8-9634-c8c143dcdf22",
  "name": "geni-dbhat",
  "projects": [
    {
      "uuid": "7e274f1d-e336-422a-ac3c-4b22fdd92dda",
      "href": "/projects/7e274f1d-e336-422a-ac3c-4b22fdd92dda",
      "name": "projectA",
      "type": "project",
      "users": [
        {
          "uuid": "3b4a2f26-b82b-46c8-9634-c8c143dcdf22",
          "href": "/users/3b4a2f26-b82b-46c8-9634-c8c143dcdf22",
          "name": "geni-dbhat",
          "type": "user"
        }
      ],
      "experiments": [
        {
          "uuid": "48f7b990-fbaa-4eb2-90a9-753f65486dbd",
          "href": "/experiments/48f7b990-fbaa-4eb2-90a9-753f65486dbd",
          "name": "exp1",
          "type": "experiment"
        },
        {
          "uuid": "f6519f8c-dc7b-4d43-a002-81f5c2c4067f",
          "href": "/experiments/f6519f8c-dc7b-4d43-a002-81f5c2c4067f",
          "name": "exp2",
          "type": "experiment"
        }
      ]
    },
    {
      "uuid": "4a4d4307-0370-4f0c-bb71-ed4ddf224d9d",
      "href": "/projects/4a4d4307-0370-4f0c-bb71-ed4ddf224d9d",
      "name": "projectB",
      "type": "project",
      "users": [
        {
          "uuid": "3b4a2f26-b82b-46c8-9634-c8c143dcdf22",
          "href": "/users/3b4a2f26-b82b-46c8-9634-c8c143dcdf22",
          "name": "geni-dbhat",
          "type": "user"
        },
        {
          "uuid": "a7ecac90-3d4a-498b-927f-f9bee6bb3156",
          "href": "/users/a7ecac90-3d4a-498b-927f-f9bee6bb3156",
          "name": "user2",
          "type": "user"
        }
      ],
      "experiments": [

      ]
    }
  ]
}

If I do

curl http://emmy9.casa.umass.edu:8002/projects/GIMITesting/users/

I can see geni-dbhat in the list

dbhat@bua-1159:/usr/local/bin$ curl http://emmy9.casa.umass.edu:8002/projects/GIMITesting/users
{
  "users": [
    {
      "uuid": "2334dd04-cab3-4bf4-8302-eb8514e70215",
      "href": "/users/2334dd04-cab3-4bf4-8302-eb8514e70215",
      "name": "geni-dbhat",
      "type": "user"
    },
    {
      "uuid": "06b0e8e9-55ad-4c64-bb80-dda04e185e02",
      "href": "/users/06b0e8e9-55ad-4c64-bb80-dda04e185e02",
      "name": "geni-cwang1",
      "type": "user"
    },
    {
      "uuid": "0fe9d7d5-6770-4ec2-a94b-593129063f1a",
      "href": "/users/0fe9d7d5-6770-4ec2-a94b-593129063f1a",
      "name": "geni-dbhat",
      "type": "user"
    },
    {
      "uuid": "ebfb6cf7-e882-4772-a270-5ed15bcc818c",
      "href": "/users/ebfb6cf7-e882-4772-a270-5ed15bcc818c",
      "name": "geni-dbhat",
      "type": "user"
    },
    {
      "uuid": "01340c9f-b67c-4c39-9b04-7e6ceefaaf33",
      "href": "/users/01340c9f-b67c-4c39-9b04-7e6ceefaaf33",
      "name": "geni-dbhat",
      "type": "user"
    }
  ]
}

Here is the code in which I am creating the JSON:

 def postUser(self):
        data = [{'name': "geni-" + self.user_name}]
        headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
        #data=json.dumps(data)
        json_filename = self.workdirectory + "/user.json"
        print ("Saving JSON to file: " + json_filename)
        jsonf = open(json_filename,'w')
        data = json.dumps(data)
        jsonf.write(data)
        jsonf.close()
        os.system('curl -X POST -H "Content-Type: application/json" --data-binary @'+ json_filename +' ' + self.restURL + ':' + str(self.restPort) + '/projects/' + self.proj_name + '/users')

The contents of my json file are:

[{"name": "geni-dbhat"}]
Last modified 11 years ago Last modified on 07/18/13 17:05:37