Updated on 2024-06-12 GMT+08:00

Creating an Instance

Description

After a customer purchases and pays for a product, KooGallery calls this interface to ask you to create an instance.

  • You must return the unique ID (instanceId) of the order. Use businessId provided by KooGallery to ensure that instanceId is globally unique.
  • Do not block this interface. If instance creation is time-consuming, create the instance asynchronously. You can generate an instance ID first and then return a response immediately. KooGallery will use the interface for querying instance information to query the instance provisioning result.
  • If pay-per-use specifications and packages are involved, develop the interface for Pushing the Pay-per-Use Resource Usage (New).
  • For details about how to obtain order information, see Querying an Order.

KooGallery may resend a request. For the same order ID (orderId) and order line (orderLineId), your server should return the same instanceId without creating a SaaS instance.

In pay-per-use transactions, ensure idempotency based on the order ID (orderId) and product ID (productId).

The following figure shows the process of creating an instance.

Request Message

The following table describes the request parameters. In KooGallery, requests are generated based on the subscription mode of products released by you. You need to provide services based on requests.

Request method: POST

Body parameters

Parameter

Mandatory

Type

Maximum Length

Description

activity

Yes

String

20

Request ID, which is used to distinguish the scenario.

For new subscriptions, the value is newInstance.

orderId

Yes

String

64

KooGallery order ID.

orderLineId

Yes

String

64

KooGallery order line ID.

businessId

Yes

String

64

KooGallery business ID.

The value of businessId is different for each request.

testFlag

No

String

2

Whether a request is submitted for debugging.

  • 1: debugging request.
  • 0: non-debugging request.

The default value is 0.

Example request:

curl -X POST 'https://www.isvwebsite.com/saasproduce?signature=11C4CD6279191DE931DEF5C51531DFFA9D37969F4E356B8A3A6D8DE4FB357A48&timestamp=1680508066618&nonce=50D83FDECAED6CCD8EF597F2A577950527928BA287D04E6036E92B2806FD17DA' -H 'Accept:application/json' -H 'Content-Type:application/json;charset=utf8' -d'{"activity":"newInstance","businessId":"87b94795-0603-4e24-8ae5-69420d60e3c8","orderId":"CS2211181819B4LVS","orderLineId":"CS2211181819B4LVS-000001","testFlag":"0"}'

Response Message

The following table describes the response parameters.

Parameter

Mandatory

Type

Maximum Length

Description

resultCode

Yes

String

6

Result code.

  • 000000: The resource is enabled synchronously.
  • 000004: The resource is enabled asynchronously.

For details, see Result Codes.

NOTE:

Return 0000004 if it takes a long time to create an instance. KooGallery will call the instance information query interface to query the instance provisioning result.

resultMsg

No

String

255

Result message.

instanceId

Yes

String

64

KooGallery business ID.

Example response:

{
    "resultCode":"000000", 
    "resultMsg":"success." , 
    "instanceId":"03pf80c2bae96vc49b80b917bea776d7"
}