(vault().consumers())
Create a consumer
package hello.world;
import com.apideck.unify.Apideck;
import com.apideck.unify.models.components.ConsumerInput;
import com.apideck.unify.models.components.ConsumerMetadata;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.VaultConsumersAddResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {
Apideck sdk = Apideck.builder()
.apiKey("<YOUR_BEARER_TOKEN_HERE>")
.consumerId("test-consumer")
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.build();
VaultConsumersAddResponse res = sdk.vault().consumers().create()
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.consumer(ConsumerInput.builder()
.consumerId("test_consumer_id")
.metadata(ConsumerMetadata.builder()
.accountName("SpaceX")
.userName("Elon Musk")
.email("elon@musk.com")
.image("https://www.spacex.com/static/images/share.jpg")
.build())
.build())
.call();
if (res.createConsumerResponse().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
Example |
appId |
Optional<String> |
➖ |
The ID of your Unify application |
dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
consumer |
ConsumerInput |
✔️ |
N/A |
|
VaultConsumersAddResponse
Error Type |
Status Code |
Content Type |
models/errors/BadRequestResponse |
400 |
application/json |
models/errors/UnauthorizedResponse |
401 |
application/json |
models/errors/PaymentRequiredResponse |
402 |
application/json |
models/errors/NotFoundResponse |
404 |
application/json |
models/errors/UnprocessableResponse |
422 |
application/json |
models/errors/APIException |
4XX, 5XX |
*/* |
This endpoint includes all application consumers, along with an aggregated count of requests made.
package hello.world;
import com.apideck.unify.Apideck;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {
Apideck sdk = Apideck.builder()
.apiKey("<YOUR_BEARER_TOKEN_HERE>")
.consumerId("test-consumer")
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.build();
sdk.vault().consumers().list()
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.cursor("<value>")
.limit(20L)
.callAsStream()
.forEach(item -> {
// handle item
});
}
}
Parameter |
Type |
Required |
Description |
Example |
appId |
Optional<String> |
➖ |
The ID of your Unify application |
dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
cursor |
JsonNullable<String> |
➖ |
Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response. |
|
limit |
Optional<Long> |
➖ |
Number of results to return. Minimum 1, Maximum 200, Default 20 |
|
VaultConsumersAllResponse
Error Type |
Status Code |
Content Type |
models/errors/BadRequestResponse |
400 |
application/json |
models/errors/UnauthorizedResponse |
401 |
application/json |
models/errors/PaymentRequiredResponse |
402 |
application/json |
models/errors/NotFoundResponse |
404 |
application/json |
models/errors/UnprocessableResponse |
422 |
application/json |
models/errors/APIException |
4XX, 5XX |
*/* |
Consumer detail including their aggregated counts with the connections they have authorized.
package hello.world;
import com.apideck.unify.Apideck;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.VaultConsumersOneResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {
Apideck sdk = Apideck.builder()
.apiKey("<YOUR_BEARER_TOKEN_HERE>")
.consumerId("test-consumer")
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.build();
VaultConsumersOneResponse res = sdk.vault().consumers().get()
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.consumerId("test_user_id")
.call();
if (res.getConsumerResponse().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
Example |
appId |
Optional<String> |
➖ |
The ID of your Unify application |
dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
consumerId |
String |
✔️ |
ID of the consumer to return |
test_user_id |
VaultConsumersOneResponse
Error Type |
Status Code |
Content Type |
models/errors/BadRequestResponse |
400 |
application/json |
models/errors/UnauthorizedResponse |
401 |
application/json |
models/errors/PaymentRequiredResponse |
402 |
application/json |
models/errors/NotFoundResponse |
404 |
application/json |
models/errors/UnprocessableResponse |
422 |
application/json |
models/errors/APIException |
4XX, 5XX |
*/* |
Update consumer metadata such as name and email.
package hello.world;
import com.apideck.unify.Apideck;
import com.apideck.unify.models.components.ConsumerMetadata;
import com.apideck.unify.models.components.UpdateConsumerRequest;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.VaultConsumersUpdateResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {
Apideck sdk = Apideck.builder()
.apiKey("<YOUR_BEARER_TOKEN_HERE>")
.consumerId("test-consumer")
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.build();
VaultConsumersUpdateResponse res = sdk.vault().consumers().update()
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.consumerId("test_user_id")
.updateConsumerRequest(UpdateConsumerRequest.builder()
.metadata(ConsumerMetadata.builder()
.accountName("SpaceX")
.userName("Elon Musk")
.email("elon@musk.com")
.image("https://www.spacex.com/static/images/share.jpg")
.build())
.build())
.call();
if (res.updateConsumerResponse().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
Example |
appId |
Optional<String> |
➖ |
The ID of your Unify application |
dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
consumerId |
String |
✔️ |
ID of the consumer to return |
test_user_id |
updateConsumerRequest |
UpdateConsumerRequest |
✔️ |
N/A |
|
VaultConsumersUpdateResponse
Error Type |
Status Code |
Content Type |
models/errors/BadRequestResponse |
400 |
application/json |
models/errors/UnauthorizedResponse |
401 |
application/json |
models/errors/PaymentRequiredResponse |
402 |
application/json |
models/errors/NotFoundResponse |
404 |
application/json |
models/errors/UnprocessableResponse |
422 |
application/json |
models/errors/APIException |
4XX, 5XX |
*/* |
Delete consumer and all their connections, including credentials.
package hello.world;
import com.apideck.unify.Apideck;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.VaultConsumersDeleteResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {
Apideck sdk = Apideck.builder()
.apiKey("<YOUR_BEARER_TOKEN_HERE>")
.consumerId("test-consumer")
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.build();
VaultConsumersDeleteResponse res = sdk.vault().consumers().delete()
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.consumerId("test_user_id")
.call();
if (res.deleteConsumerResponse().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
Example |
appId |
Optional<String> |
➖ |
The ID of your Unify application |
dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
consumerId |
String |
✔️ |
ID of the consumer to return |
test_user_id |
VaultConsumersDeleteResponse
Error Type |
Status Code |
Content Type |
models/errors/BadRequestResponse |
400 |
application/json |
models/errors/UnauthorizedResponse |
401 |
application/json |
models/errors/PaymentRequiredResponse |
402 |
application/json |
models/errors/NotFoundResponse |
404 |
application/json |
models/errors/UnprocessableResponse |
422 |
application/json |
models/errors/APIException |
4XX, 5XX |
*/* |