package com.cargopooling.api.examples; import com.cargopooling.api.bean.authentication.TokenResult; import com.cargopooling.api.bean.smartcargo.JobResult; import com.cargopooling.api.core.CargopoolingApiCore; import com.cargopooling.api.service.authentication.AccessTokenService; import com.cargopooling.api.service.smartcargo.JobsService; import java.io.IOException; /** * * * Copyright 2016 - Cargopoooling, Inc. - U.S.A. * Author: Cristian Costantini * www.cargopooling.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * **/ public class ReadJobExample { private final CargopoolingApiCore core; private final JobsService service; public ReadJobExample(String configPath) throws IOException { this.core = new CargopoolingApiCore( configPath ); this.service = core.createJobsService(); } public void read( String jobId ) throws Exception { // Get Access Token String token = connect(); JobResult result = (JobResult) service.read( token, jobId ); } private String connect() throws Exception { AccessTokenService service = core.createAccessTokenService(); TokenResult tokenResult = service.getAccessToken(); return tokenResult.getResult(); } }
Jobs Read Example
Have more questions? Submit a request
Comments