Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add swagger docs for new OEM partners API #454

Closed
wants to merge 9 commits into from

Conversation

lcaparroz
Copy link
Member

In this pull request I implement Swagger for documenting the OEM partners API.

We need to document the new API for pre-activation of OEM partner orders
(to be implemented yet).

As a first start, I documented the current API with Swagger/OpenAPI.
@lcaparroz lcaparroz self-assigned this Apr 6, 2021
In this commit, I add documentation for the coming endpoints
`partner_orders/pre_activation` and `partner_order/renewal`, which are
yet to be implemented.
@SUSE SUSE deleted a comment from suse-tests-pass Apr 6, 2021
@SUSE SUSE deleted a comment from suse-tests-pass Apr 6, 2021
@@ -1,5 +1,17 @@
The purpose of this document is to describe the way of communication between OEM partners and SUSE Customer Center API.

A Swagger documentation is available in this repository. You just need to server it locally with the following commands:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A Swagger documentation is available in this repository. You just need to server it locally with the following commands:
A Swagger documentation is available in this repository. You just need to serve it locally with the following commands:

`APIAuth-HMAC-SHA256 112233:wvSi7Ach641iUvDTVE5AEVQCwXdH0uSfUQecJTlLSIolxVmqmk7gESkUIi+65R4x6OcDNy6ytVNBbQ5hlLzBpH0V3QolvYFHRgwQqcGhcbSDrUX7nQyVREilfVJ4FYaIirBnfXWYwi9K43bXHcEWj/mBQ1A8c7vpViWpalCdf8M=`

servers:
- url: "{protocol}://scc.suse.com/api/oem"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that {protocol} bit required? I just ask because we really only accept HTTPS, and it looks weird in the UI:

image

required: true
type: array
items:
$ref: '/swagger/swagger.yaml#/components/requestBodies/PartnerOrderItemPayload'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I miss the description of these fields.
What are they for? Do they need to follow a format? Do they have any validations?
And also importantly: what does SCC do with the data?

For example:

  • Does OEM token need to be unique?
    In the case of in-activated subs, we could document that end-users need to use the token to claim their subscriptions; in the case of pre-activated subs, end-users don't need it, but we should state that the renewal order needs to have the same token as the original order, etc.
  • Email: do we send the user something? Is only 1 email allowed?
  • starts at: how does the end date get calculated? does it really need to be a date-time, or can we allow a simple date?
  • end_user_account_number: what is this for? Does it need to follow a format?

schema:
$ref: '/swagger/swagger.yaml#/components/requestBodies/PartnerOrderPayload'
responses:
'200':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 200 the only possible response? What about errors? How are they presented, in terms of error code and message format?

- $ref: '/swagger/swagger.yaml#/components/parameters/Date'
- $ref: '/swagger/swagger.yaml#/components/parameters/ContentMd5'
- $ref: '/swagger/swagger.yaml#/components/parameters/Authorization'
summary: Place a pre-activated OEM partner order
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we explain somewhere the difference between a "pre-activated" partner order and "regular" (?) partner order?

@lagartoflojo
Copy link
Contributor

I know I left a lot of comments, but don't take it the wrong way =) I think this is a GREAT improvement over our existing documentation!

required: true
type: string
example: 987654
end_user_account_number:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we accept UC site id's here, in addition to SF account numbers?
I ask because brand new SUSE customers will not have a SF account number.
Right now, we allow customers to enable OEM subs on a UC org, and at that point we create the account in SF and assign its SF account number.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we should work only with the UC site IDs then? If this is data which the end user can always inform OEM partners, maybe it's a better option to consider.

Otherwise, do you think we should accept both UC site IDs and SF account numbers?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I understand, most FJ customers are also SUSE customers, so they will have an SF account number.
But there will be some that are not SUSE customers yet, and will therefore not have an SF acct num.
Therefore, I think we could accept both.

content:
application/json:
schema:
$ref: '/swagger/swagger.yaml#/components/schemas/PartnerOrder'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the call today, did I understand correctly that renewal partner orders do not need to receive a starts_at nor a the end user account number?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is right. And also I understand that there'll be no use for the expires_at date once subscriptions' lifespans will be computed using the SKU duration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok; I think we are still displaying those fields in the docs for the renewal endpoint though, aren't we?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the PartnerOrder schema is the same in all endpoints, just the payloads differ.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yes, I commented on the wrong line, sorry! I meant about the payload. Are the different payloads for new/renew orders documented?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if you check the request body section of each operation, there is Example value, and then you can switch to Schema

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm improving the field and operations descriptions to match the the same style used in the SCC API Swagger.

@SUSE SUSE deleted a comment from suse-tests-pass Apr 13, 2021
@SUSE SUSE deleted a comment from suse-tests-pass Apr 16, 2021
@SUSE SUSE deleted a comment from suse-tests-pass Apr 21, 2021
@SUSE SUSE deleted a comment from suse-tests-pass Jun 28, 2021
@SUSE SUSE deleted a comment from suse-tests-pass Jul 16, 2021
@SUSE SUSE deleted a comment from suse-tests-pass Jul 20, 2021
@SUSE SUSE deleted a comment from suse-tests-pass Jul 29, 2021
@suse-tests-pass
Copy link
Collaborator

Well Done! Your tests are still passing.
https://ci.suse.de/job/SCC-Connect-Prophet/425019/console
If the given link has expired,you can force a Prophet rerun by just deleting this comment. (Merged b46f3e2 into 1b377c9)

@lcaparroz
Copy link
Member Author

Closing this PR since we moved the Swagger documentation to https://scc.suse.com/connect/v4/documentation/.

@lcaparroz lcaparroz closed this Aug 10, 2021
@lcaparroz lcaparroz deleted the new-partners-api branch August 10, 2021 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants