You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Planning REST APIs - List File

edited Sep 18, 2018 6:25PM in Planning 5 comments

Summary

Planning REST APIs - List File

Content

Hi All.

I am using the list files api () to check for a file.

The JSON response has a field "lastmodifiedtime". The value is "1534769532000". How do we convert this value to Date Format? Find below an example

 {  
         "lastModififedTime":"1534769532000",
         "name":"FS_Data.csv",
         "type":"EXTERNAL",
         "size":"649890"
      }

Thanks,
Arun

Version

18.09.63

Code Snippet

	response = requests.get(url,auth=HTTPBasicAuth(user_name,password),headers = headers)
	if response.status_code == 200:
		response = json.loads(response.text)
		for f in response['items']:
			if (f['type'] == fileType and f['name'] == "CEIX_Assets_Cost_Details.csv"):
				print("file found")
				print(f['lastModififedTime'])
				print(f['name'])
				print(f['type'])
				print(f['size'])
Tagged:

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!