** remoteLogging.txt


* Instructions for database:

http://avyayatek.com/for_nd/webservices/info_instructions.txt

    CREATE     <===>     PUT
    READ       <===>     GET
    UPDATE     <===>     POST
    DELETE     <===>     DELETE


---- LOCATION ----------

DELETE:

1. delete location

https://www.avyayatek.com/spl-logger/rest/locations/id/18
where the trailing 18 is the location id you want to delete

2. Based on the account number:

https://www.avyayatek.com/spl-logger/rest/locations/5

*** Here's the CURL command for adding just one spl-data item to the table:
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{"eventId":1,"splData":[{"dateTime":"testTimeDate","secsSince1970":8.9,"splValue":1.8}]}' http://localhost:8080/spl-logger/rest/events/update

*** Here's the CURL command for adding more than one spl-data item to the table:
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{"eventId":1,"splData":[{"dateTime":"date1","secsSince1970":1.1,"splValue":2.2},{"dateTime":"date2","secsSince1970":3.3,"splValue":4.4}]}' http://localhost:8080/spl-logger/rest/events/update


http://localhost:8080/spl-logger/rest/events/location/header/json/1
where trailing 1 in the URL is the location id for which you wish to have all the event headers.


*** You can now delete all events for a location id.
curl -i -X DELETE https://www.avyayatek.com/spl-logger/rest/events/id/1


*** To get the account number for an email address:

URL is: http://localhost:8080/spl-logger/rest/members/IdFromEmail/email_addr

The trailing email_addr is the email string you have to send.
The IdFromEmail is the method name - don't change that - it's part of constant URL

The IdFromEmail API is a bit different. You have seen responses come back in a json msg body thus far.

This time, i am returning the member id as part of the HTTP response header. So, you will have to parse the HTTP response header which is pretty straightforward since ios already handles it.

The response looks like this:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: */*
Content-Length: 15
Date: Sun, 24 Feb 2013 23:53:53 GMT
{member id: 1}

You just have to filter out "member id" key-value-pair. 

The value of member id will be -1 if there was no match.

***


***  "delete all locations for an account".
The command is like this:
curl -i -X DELETE  https://www.avyayatek.com/spl-logger/rest/locations/1
where the trailing 1 is the account number.

*** The command to delete one location based on a location id is -
curl -i -X DELETE  https://www.avyayatek.com/spl-logger/rest/locations/id/1
where the trailing 1 is the location id.

*** This URL will give you the total entries in the SPL-Data event for a given event id. The trailing "1" here is the event id.
https://www.avyayatek.com/spl-logger/rest/events/TotalSplDataTableRowsForEventId/1

*** will give you the total entries in the SPL-Data event.
http://localhost:8080/spl-logger/rest/events/TotalSplDataTableRows

***************************** APIs Currently Used:  **********************************************

Members:
	[requestAcct setHTTPMethod:@"GET"];
    NSString *urlStrAcct = [NSString stringWithFormat:@"https://www.avyayatek.com/spl-logger/rest/members/IdFromEmail/%@", accountEmail];
	[requestAcct setURL:[NSURL URLWithString:urlStrAcct]];

	[request setHTTPMethod:@"GET"];
    NSString *urlStr = [NSString stringWithFormat:@"https://www.avyayatek.com/spl-logger/rest/members/json/%d", acct];
	[request setURL:[NSURL URLWithString:urlStr]];

	[request setHTTPMethod:@"GET"];
    NSString *urlStr = [NSString stringWithFormat:@"https://www.avyayatek.com/spl-logger/rest/members/json/"];
	[request setURL:[NSURL URLWithString:urlStr]];

    [request setHTTPMethod:@"PUT"];
    [request setURL:[NSURL URLWithString:@"https://www.avyayatek.com/spl-logger/rest/members/"]];

    [request setHTTPMethod:@"POST"];
    NSString *postStr=[NSString stringWithFormat:@"https://www.avyayatek.com/spl-logger/rest/members/%d",acc.accountNumber];

    [request setHTTPMethod:@"DELETE"];
    NSString *postStr=[NSString stringWithFormat:@"https://www.avyayatek.com/spl-logger/rest/members/%d",acc.accountNumber];

Locations:
	[request setHTTPMethod:@"GET"];
    NSString *urlStr = [NSString stringWithFormat:@"https://www.avyayatek.com/spl-logger/rest/locations/json/%d", accountNumber];
	[request setURL:[NSURL URLWithString:urlStr]];

    [request setHTTPMethod:@"PUT"];
    [request setURL:[NSURL URLWithString:@"https://www.avyayatek.com/spl-logger/rest/locations/"]];

    [request setHTTPMethod:@"POST"];
    NSString *postStr=[NSString stringWithFormat:@"https://www.avyayatek.com/spl-logger/rest/locations/id/%d/", tempLoc.locationId]
    
    [request setHTTPMethod:@"DELETE"];
    NSString *postStr=[NSString stringWithFormat:@"https://www.avyayatek.com/spl-logger/rest/locations/id/%d", loc.locationId];
    [request setURL:[NSURL URLWithString:postStr]];

Events:
    [request setHTTPMethod:@"PUT"];
    [request setURL:[NSURL URLWithString:@"https://www.avyayatek.com/spl-logger/rest/events/"]];

    [request setHTTPMethod:@"POST"];
    NSString *postStr=[NSString stringWithFormat:@"https://www.avyayatek.com/spl-logger/rest/events/header/update/%d",remoteEvent.eventId];

    [request setHTTPMethod:@"POST"];
    [request setURL:[NSURL URLWithString:@"https://www.avyayatek.com/spl-logger/rest/events/update"]];
    
    [request2 setHTTPMethod:@"DELETE"];
    NSString *postStr2=[NSString stringWithFormat:@"https://www.avyayatek.com/spl-logger/rest/events/id/%d", loc.locationId];
    [request2 setURL:[NSURL URLWithString:postStr2]];

    // also need GET ALL EVENTS FOR ONE EVENT ID
    
    // and need GET EVENTS BETWEEN 2 TIMES FOR ONE EVENT ID

Devices:
	[request setHTTPMethod:@"GET"];
    NSString *urlStr = [NSString stringWithFormat:@"https://www.avyayatek.com/spl-logger/rest/devices/json/"];
	[request setURL:[NSURL URLWithString:urlStr]];

    [request setHTTPMethod:@"PUT"];
    [request setURL:[NSURL URLWithString:@"https://www.avyayatek.com/spl-logger/rest/devices/"]];

    [request setHTTPMethod:@"POST"];
    NSString *postStr=[NSString stringWithFormat:@"https://www.avyayatek.com/spl-logger/rest/devices/%d", dev.deviceId];

    [request setHTTPMethod:@"DELETE"];
    NSString *postStr=[NSString stringWithFormat:@"https://www.avyayatek.com/spl-logger/rest/devices/%d", dev.deviceId];
    [request setURL:[NSURL URLWithString:postStr]];


***************************************************************************
* payment portal:

https://cheddargetter.com/user/login

a@s6d.com
P78


* java applet:

bearpeak.com

